This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

implementation problem in C


Can someone please help me with this simple implementation problem in C:

I have a table in which each entry designates a pointer to some function,
the number of argument it expects and if it returns a value:

typedef struct {
    void *func;
    int argc, ret;
} call_t;

call_t call_table[]={
    {func1, 3, 0},
    {func2, 2, 1},
    {func3, 3, 1},
    ...
}

Now suppose that I have the index to the function I want to call and all the
values of the parameters required, how do I call this function with the
proper parameters passed?
In C, I know how to call a function from a function pointer if the number of
arguments is known statically. But in this case, the number of arguments in
known only dynamically.

thanks,
David


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]