Venu
13th April 2005 18:57 UTC
call __stdcall function in WIn32 dll from NSIS
Hi All,
I have created a Win32 DLL with a function exported as -
#define MY_API extern"C" __declspec(dllexport)
MY_API int __stdcall myFunc(char *path);
When i call this function from NSIS it is failing. Though its entering the DllMain the function does not get called.
If i remove remove __stdcall and compile the DLL with __cdecl calling convention it works.
What is the work around for calling functions with __stdcall calling convention
Rgds
Venu
kichik
14th April 2005 18:15 UTC
How exactly do you call it? The System plug-in uses the stdcall calling convention by default.
Venu
15th April 2005 06:09 UTC
Hi Kichik,
Function Declaretion in Dll:
#define MY_API extern"C" __declspec(dllexport)
MY_API int __stdcall myFunc(char *path);
Calling the function from NSIS:
StrCpy $0 "NSIS"
System::Call '$EXEDIR\MyDll::myFunc(t)i(r0).r1'
Iam using VC++6 and NSIS 2.06
Takhir
15th April 2005 07:38 UTC
Order of args for one parameter may be not so important..
BTW what name shows Dependency Walker for yor dll?
Venu
18th April 2005 06:40 UTC
Hi Takhir,
The dependency walker shows the name:
int myFunc(char *)
( Decorated Name: ?myFunc@@YGHPAD@Z )
kichik
19th April 2005 18:22 UTC
That's not good. NSIS uses the name shown by Dependency Walker (?myFunc@@YGHPAD@Z). Add extern "C" before the function definition if you're compiling a C++ file. For example:
extern "C" void myFunc(char *);