int foo(int a);
int foo(int a = someDefaultArgument);
or
int foo(int a);
int foo(void);
Name:
Anonymous2010-04-25 14:58
Is it possible to programatically vary parameters in C from the caller side? (for the calee side you can use the varargs macros)
Example: you want to read from a file a dynamic library name, a function name, and a list of parameters it takes along with their values.
You use a system call to load the library. You use another to get a function pointer to the function by name. But now, how do you call it? (you didn't know the number or types of the parameters at compile time)
Bonus points if you can even specify the calling convention.
(Of course this can be done with inline assembly, but there must be a portable way - many interpreted languages whose interpreters are written in C allow this)