Skip to content
⌘ NSIS Forum Archive

Cannot build a working plugin

3 posts

Marshallx7#

Cannot build a working plugin

I am using scons to build a plugin for NSIS.
It successfully builds a DLL file but when I try to call the exported function makensis reports "invalid command".
I have checked with depends and the function is exported. Other plugins work fine.

I have installed VS2015 but see mention that NSIS only supports 2005 !
Trouble is, 2005 is not available any more as it is 10 years old (ok, there are software sites that offer it but I do not trust them).

Does anybody have any idea why makensis wouldn't be able to read the DLL properly and what I should do to build a supported DLL using VS2015?
Anders#
Using SCons is only required when building NSIS and its official plugins. You can build 3rd-party plugins in the Visual Studio IDE without using SCons and with any version you want from Visual Studio 6 to 2015 but the older the better if you want to support old versions of Windows.

When MakeNSIS reports a error when calling a plugin it can mean one of two things:

A) It cannot find the .dll. NSIS v3 changed the plugin directory structure so make sure you put your .dll in the correct place or use !AddPluginDir.

B) It cannot find the exported function. This can happen when you don't use a .def file. Download Dependency Walker from dependencywalker.com and look at your exports. If it starts with a _ (underscore) or contains a @ sign then something is wrong with your compiler settings and/or the function declaration. Try something like: EXTERN_C __declspec(dllexport) void __cdecl MyFunction(HWND hwnd, int stringsize, ...) {} or use a .def file.
Marshallx7#
Thanks Anders that put me on the right path. I now have a working DLL!

Next step will be to make sure it actually works in windows XP onwards and that all the dependencies are handled correctly.
I'd also like to reduce the size (through the IDE it is 13KB but when I was trying to do it the non-working way through scons it was only 4KB).