Original Post
Hi,
I have an API (DLL) with many hundreds of commands but only about 40 functions.
It looks like this:
enum { command1=0, command2,command3,command4, etc.};
bool function1(int commandID,int arg1,int arg2,float* arg3);
bool function2(int commandID,int arg1,float arg2,float* arg3);
bool function3(int commandID,int arg1,float arg2,char* arg3);
etc.
A same function can be called with different commandIDs, but the argument list has to match the function's argument list. Like this:
function1(command1,intArg1,intArg2,floatPointer);
function1(command3,intArg1,intArg2,floatPointer);
This is working fine but I want to do it more easy and flexible. I want to declare my functions like this:
bool function1(int commandID,void* arg1,void* arg2,void* arg3);
so that I can pass just any argument type. The only problem is when an argument passed is not a variable, like that:
function1(command1,100.0f,15,3);
This won't compile. I tried to append a '&' to get the address of the constants but it doesn't work of course! What are my options?
I could do:
float a=100.0f;
int b=15;
int c=3;
function1(command1,&a,&b,&c);
but that's not nice at all. How can I call the function with constant values in one line? It this possible?
I hope I was not too confusing (^_^;
Thanks
[edited by - Floating on September 3, 2003 8:45:17 PM]