开发者

Calling any dll function based on variable arguments

开发者 https://www.devze.com 2022-12-17 10:02 出处:网络
I have the following items in a structure: - Dll name (absolute/relative path) - Function name in the dll

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 this 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消