Wrapper to function with varargs
-
I have a function in a DLL which takes varargs. I only have the header file of the DLL. Is there a way how i can provide a wrapper for the function with varargs? For e.g. if the function definition is as follows:
int average( int first, ... ); // calculate average of a series of integers
..how can i provide a wrapper for it? I'm stuck here:int averageWrap(int first, .../*how do i handle varargs here?*/) { return average(first, ... /*how do i pass the varargs params?*/); }
Thanks _________________________ Kri5 -- modified at 5:50 Thursday 13th April, 2006 -
I have a function in a DLL which takes varargs. I only have the header file of the DLL. Is there a way how i can provide a wrapper for the function with varargs? For e.g. if the function definition is as follows:
int average( int first, ... ); // calculate average of a series of integers
..how can i provide a wrapper for it? I'm stuck here:int averageWrap(int first, .../*how do i handle varargs here?*/) { return average(first, ... /*how do i pass the varargs params?*/); }
Thanks _________________________ Kri5 -- modified at 5:50 Thursday 13th April, 2006 -
Those are for iterating through the parameters one by one. I need to be able to fetch them and pass them on to the function i am wrapping...i don't think those functions can help me. :( _________________________ Kri5 -- modified at 9:04 Thursday 13th April, 2006
-
I have a function in a DLL which takes varargs. I only have the header file of the DLL. Is there a way how i can provide a wrapper for the function with varargs? For e.g. if the function definition is as follows:
int average( int first, ... ); // calculate average of a series of integers
..how can i provide a wrapper for it? I'm stuck here:int averageWrap(int first, .../*how do i handle varargs here?*/) { return average(first, ... /*how do i pass the varargs params?*/); }
Thanks _________________________ Kri5 -- modified at 5:50 Thursday 13th April, 2006i'm not sure you can. many libraries that export "..." functions also export va_list versions specifically so people can build layers on top of those functions. Cleek | Image Toolkits | Thumbnail maker