Pointer to function with variable argument list
-
Hi, I am writing a wrapper for a DLL that has 2 functions: int func1(long p1); int func2(char *p1, ...); The wrapper creates pointes to the two functions: int (* pfunc1)(long p1); int (* pfunc2)(char *p1, ...); To call function 1 I do: wrapper.pfunc1(1234); My problem is: how do I call func2 using the pointer? Sometimes I may pass 1 parameters, sometimes 2 or 3 or 4, and the data types may change. Is it possible at all to do this? Thanks
-
Hi, I am writing a wrapper for a DLL that has 2 functions: int func1(long p1); int func2(char *p1, ...); The wrapper creates pointes to the two functions: int (* pfunc1)(long p1); int (* pfunc2)(char *p1, ...); To call function 1 I do: wrapper.pfunc1(1234); My problem is: how do I call func2 using the pointer? Sometimes I may pass 1 parameters, sometimes 2 or 3 or 4, and the data types may change. Is it possible at all to do this? Thanks
yaron klodovski wrote:
how do I call func2 using the pointer?
same as you are using pfunc1.
yaron klodovski wrote:
Sometimes I may pass 1 parameters, sometimes 2 or 3 or 4, and the data types may change.
you need to assign address of function having prototype same as function pointer.
i.e. function may look like this
int foo(char*,int);
or
int foo(char*,char*,int);Prasad Notifier using ATL