_VAPPLY - call arbitrary function with variable arg list.

(GCOS-8 only)


#include <stdarg.h>
retval = _vapply( function_ptr, arglist );


type (*function_ptr)();
points to the function you want to call. The type of value returned by this function can be up to two machine words long.
va_list arglist;
is a variable argument list containing the arguments that should be passed to the function.
is the value returned by the function indicated by "function_ptr". This can have a length of up to two machine words.


"_vapply" constructs and executes a call to the specified function. The arguments in the "arglist" variable argument list are passed to the function and the value which the function returns is returned to "retval".

"_vapply" is particularly useful for routines which are called with a variable number of arguments and which wish to pass these arguments on to another function.


#include <stdio.h>
#include <stdarg.h>
#include <time.h>
logmsg( const struct tm *logtime, ...)
    /* format message with time, then print out stdout */
    va_list ap;

Note: this is just an artificial example. You would normally use the "vprintf" function for this purpose.

See Also:

expl nsc lib apply

Copyright © 1996, Thinkage Ltd.