In article <c5************@ID-149533.news.uni-berlin.de>, "Alex" <me@privacy.net> writes:
"matevz bradac" <ma*****@email.si> wrote in message
news:cc**************************@posting.google.c om...
[snip] When execList() is called, fcnToCall (numArgs, ...) should
be executed. The problem is, how do I store variable args
for future use?
Assembly is probably the only way to do exactly what you describe,
unfortunately. Using the functions in <stdarg.h>, you could store a
suitably-sized array of the longs (when creating the function list), but
that wouldn't help much as there's no way in standard C to construct the
call to the variadic function.
I couldn't tell from the OP's description, but this might be another
case where the problem can be solved by implementing the real function
as a non-variadic one with a variadic wrapper. That is:
int fcnToCallV(long numArgs, va_list Args);
int fcnToCall(long numArgs, ...)
{
va_list Args;
int Ret;
va_start(Args, numArgs);
Ret = fcnToCallV(numArgs, Args);
va_end(Args);
return Ret;
}
(The OP didn't mention a return type for these functions, so I assumed
int.)
Then the OP's call-list system stores a call to fcnToCall as one to
fcnToCallV, by doing the va_start before storing it and the va_end
when processing the list, after the call returns.
--
Michael Wojcik
mi************@microfocus.com
The movie culminated with a bit of everything. -- Jeremy Stephens