Archive: Why the signature of NSIS plugin doesn't match the one in the script?


Why the signature of NSIS plugin doesn't match the one in the script?
Hi all,
I'm new to NSIS, and try to wrapper the custom control written in C++ as a dll/plugin and call the related api from nsis script, however, i do notice that in the nsis example, the InstallOptions plugin which have a C++ signature just like

extern "C" void __declspec(dllexport) dialog(HWND hwndParent, int string_size,
char *variables, stack_t **stacktop)

however, it just called in a script(testlink.nsi) like
InstallOptions::dialog "$PLUGINSDIR\test.ini"

Why the signature doesn't match with their counterpart? What have happened in the NSIS source code underbeneath?

Thanks


Actually the full signature now is:

extern "C" void __declspec(dllexport) name(HWND hWndParent, int string_size, TCHAR* variables, stack_t** stacktop, extra_parameters* extra)
(backwards compatible). As for your question, the parameters you pass in the script are not passed as parameters to the plug-in function. Instead they are passed via the NSIS stack. You use popstring to grab them.

Have you had a look at the System plug-in? You can call normal DLLs with that; would save you converting your one to an NSIS plug-in.

Stu

Originally posted by Afrow UK
Actually the full signature now is
You are missing a __cdecl in there...

You probably know this already but __cdecl is the default calling convention so you don't have to specify it.

Edit: Unless using msbuild with /Gr or /Gz.

Stu


Even if cdecl is the default it should still be a part of the signature when posted in public. IMHO stdcall produces smaller and faster code, everyone should be using it on Windows.