This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
implementation problem in C
- From: "David Janssens" <dja at info dot ucl dot ac dot be>
- To: <gcc-help at gnu dot org>
- Date: Thu, 30 Jan 2003 16:11:46 +0100
- Subject: 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