I got a problem when calling a function from DLL. And this rule is not well document in MSDN I guess. Thus it could be a very common mistake for those who are new to DLL. I have capture the rules when trying to call a function in DLL from the client program. Lets assume a simple DLL is created, and with a FuncA() being export to the client program in that DLL.
Rule 1) When fucntion is declare using __declspec
#define __EXPORT_MODULE __declspec(dllexport)
__EXPORT_MODULE int FuncA();
The function name from Dependencies Walker is shown like below
?FuncA@@YBHWZ
Rule 2) When function is declare using extern "C"
#define __EXPORT_MODULE extern "C" __declspec(dllexport)
__EXPORT_MODULE int FuncA();
The function name from Dependencies Walker is shown like below
?FuncA
Hope this make a clear sense :)
Saturday, July 11, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment