Archive: Using C++ DLL


Using C++ DLL
Hi,

I am using VStudio 2005 to create a DLL to be used by one of our installers but and I can't get System::Call to work.

I think it is because of the name decoration of the functions. I can debug the DLL and see that the main function is being called and the DLL is being loaded.

Does anybody know how to deal with the name decoration?



I am using
#ifdef NSWWW_EXPORTS
#define NSWWW_API __declspec(dllexport)
#else
#define NSWWW_API __declspec(dllimport)
#endif

and the function is:

NSWWW_API int fnnsWWW(int i)
{
MessageBox(NULL, _T("fnnsWWW"), _T("Test"), MB_OK);
return 42;
}

The call to System::Call returns "error"

SetPluginUnload alwaysoff
InitPluginsDir
File /oname=$PLUGINSDIR\nsWWW.dll nsWWW.dll
...
SetOutPath $PLUGINSDIR
System::Call 'nsWWW::fnnsWWW(i r0) i .r6'
MessageBox MB_OK $6

Any help is welcome!

Thanks


Try to give $0 a value:
StrCpy $0 5
System::Call 'nsWWW::fnnsWWW(i r0) i .r6'


I was already setting $0, but forgot to add to the sample lines.
Nonetheless, i retried for the sake of it and still no luck.
Thanks


Add extern "C" in front of the function signature

extern "C" NSWWW_API int fnnsWWW(int i)


You could also make a real NSIS plugin DLL directly, instead of a DLL to be called with System::Call