views:

58

answers:

1

I have the following items in a structure - Dll name (absolute/relative path) - Function name in the dll - number of parameters - Array of parameter types and values

With these information, I need to load the dll and call the function. To load the dll - I would use loadlibrary To get the address of the function - I would use GetProcAddress Call the function To unload the dll - freelibrary

Since the number of arguments of the function is dynamic, I am not sure about how the arguments need to be passed to the function.

Can anyone provide some details on how the parameters can be passed to the dll function.

Thanks and Regards, V Karthick

A: 

Is it possible to pass the dictionary object (the one with the parameters) to some wrapper function and have that wrapper function call the actual function? It would probably save you a lot of headache and you could potentially use the preprocessor to generate the wrapper functions for you.

Travis Gockel
I am not sure of how the wrapper function will call the final dll. The possible combinations would be enormous - considering a maximum of 10 parameters and parameter types to be int, float and string.
Karthick
The idea would be to write the wrapper function in the DLL itself. This way, the wrapper would know what to expect in the dictionary and know how to allocate them.
Travis Gockel