Re: [CODE] Running functions from variables

From: Mark A. Heilpern (heilpern@MINDSPRING.COM)
Date: 08/11/98


Look at how SpecProc's are done. Basically, if you have:

int funcname(); /* function or its prototype */

and you have:

int (*funcptr)();   /* pointer to function returning an int */

You can assign as:     funcptr = funcname;
Then you can use as:  x = funcptr();


At 07:11 PM 8/9/98 +1000, you wrote:
>Hey all. This is sort of a C question, and doesn't really have much to
>do with Circle, although it's for use in Circle.
>
>If ch->func was a type char, let's say its:
>
>"do_something(yahoo, yeh, 1)"
>
>Is there a way I can run that char (ch->func) as a function? Something
>like
>
>do_function(ch->func);
>
>or something like that? I might be making no sense what so ever....
>
>Thanks, -- Urion.
>
>
>     +------------------------------------------------------------+
>     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
>     +------------------------------------------------------------+
>


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST