www.digitalmars.com         C & C++   DMDScript  

c++ - Passing variable arguments through a function pointer Q.

I'm looking to create a function which can take a pointer to a function with any
number of arguments, and any number of additional arguments, and call that
function with the supplied arguments, I'm not aware of how to do this.

Pseudo-Code idea:
void Foo(void * vdFunction(), ...)
{
vdFunction(*arguments*);
}

I know one method would be to use stdargs.h, get the number of arguments passed,
and switch depending on the number of arguments, passing to the function each
argument iterated out, but that seems to be rather sloppy, and I can only have
as many arguments as I supply switch statements. Is there a better way to do
this?

Additionally, is there a way, in my code, to get a pointer to each function in
my code?

Thanks in advance.
Sep 11 2003