I'm trying to build a NSIS plugin using MSVS 2005 (also tried MS visual C++ toolkit 2003), but when I call the exported function from NSIS, nothing happens.
Here's example code to illustrate the problem:
#include "stdafx.h"
#include <windows.h>
#include "nsis_ansi\pluginapi.h"
#define NSISFUNC(name) extern "C" void __declspec(dllexport) __cdecl name(HWND hWndParent, int string_size, char* variables, stack_t** stacktop, extra_parameters* extra)
NSISFUNC(Test)
{
MessageBox(0,"Test",0,0);
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
I'm using the default options set by MSVS2005.
I'm assuming there's some sort of dynamic dependency that this DLL cannot find.
Anyone ever experienced this?
Would appreciate help with this,
Thank you!
The most common problem is linking to one of the C run-time dll's (msvcrt*.dll), you can inspect your imports with Dependency Walker.
Because NSIS runs on Win95 we don't use the CRT at all but if your target is Win98+ then you can get away with linking to the plain msvcrt.dll (with no version number). This is harder to do in VS 2003 and later so using /MT
or other CRT options is often less work. If you are willing to use the DDK/WDK instead of VS then you can link to the plain msvcrt.dll...