M
moreau.steve
Hi guys,
I am trying to make a wrapper above a function with variable number of
arguments (called function_in_library in this example), which I cannot
modify, and for which no equivalent with va_args exist. I would like
to know if there is mean to call this function with the same arguments
of the wrapper function.
I met this issue several times and workarounded it each time making a
new function 'function_in_library2' equivalent to
'function_in_library' but with this prototype function_in_library2(int
param1, va_list args). In this case, I am stucked since I cannot hack
the library...
Here is the example :
void function_in_library(int param1, ...)
void wrapper(char* interface_name, int param1, ...) {
init_interface(interface_name);
// do all my stuff
// call function_in_library
function_in_library(param1, ...) // is it possible to do the call
without hacking the stack
}
int main(int argc, char **argv) {
wrapper(READ_WRITE, "here", "are", "args");
return 0;
}
Thank you
Steve
I am trying to make a wrapper above a function with variable number of
arguments (called function_in_library in this example), which I cannot
modify, and for which no equivalent with va_args exist. I would like
to know if there is mean to call this function with the same arguments
of the wrapper function.
I met this issue several times and workarounded it each time making a
new function 'function_in_library2' equivalent to
'function_in_library' but with this prototype function_in_library2(int
param1, va_list args). In this case, I am stucked since I cannot hack
the library...
Here is the example :
void function_in_library(int param1, ...)
void wrapper(char* interface_name, int param1, ...) {
init_interface(interface_name);
// do all my stuff
// call function_in_library
function_in_library(param1, ...) // is it possible to do the call
without hacking the stack
}
int main(int argc, char **argv) {
wrapper(READ_WRITE, "here", "are", "args");
return 0;
}
Thank you
Steve