|
![]() |
|
Thread Tools | Search this Thread | Display Modes |
![]() |
#1 |
Junior Member
Join Date: Jul 2012
Posts: 5
|
![]()
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 |
![]() |
![]() |
![]() |
#2 |
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Actually the full signature now is:
(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.code: 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 |
![]() |
![]() |
![]() |
#3 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,358
|
You are missing a __cdecl in there...
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#4 |
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
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 |
![]() |
![]() |
![]() |
#5 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,358
|
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.
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
|
Tags |
custom, function, nsis, visual c++ |
Thread Tools | Search this Thread |
Display Modes | |
|
|