Archive: My plugin isn't loaded


My plugin isn't loaded
Hello forum.

I've developed my plugin. I copy the dll file on NSIS_INSTALL/Plugins and compile my script. When I perform the installer, it tells me that the dll can't be loaded:

http://i16.photobucket.com/albums/b45/jeusdi/NSIS2.png

Can you help me about?
I will appreciate your help a lot.

My C++ main code:


#include <windows.h>
#include "NSIS/pluginapi.h"
//#include "gSOAP/InstWs.h"
#include "plugin.h"

HINSTANCE g_hInstance;
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
g_hInstance = hInst;
return TRUE;
}

/***************************************************************************************
* Function: GmCaptureEx::ActivateLicence (exported)
* Description:
* Activates and retrieves from a WS a licence. This licence is saved on a file.
* Parameters:
* - licence_type_code: The licence type code.
* - customer_code: The customer code.
* - customer_passwd: The customer password.
* - customer_mail: The customer mail.
* - #fields: Number of fields.
* - fields: Parametrized fields in order to activate the licence.
***************************************************************************************/
NSISFunction(Activate)
{
EXDLL_INIT();
{
char licence_filename[23];
params_t params;
int nfields;

ActivateLicence("licence_code", "customer_code", licence_filename);

popstring(params.licence_type_code);
popstring(params.customer_code);
popstring(params.customer_passwd);
popstring(params.customer_passwd);
params.nfields = popint();

...

pushstring("result");
}
}


Note: I've created the dll with Visual C++ as Win32 dynamic library. This library uses other library. When I build the projects these generates their *.dll and *.lib files. I've tried to copy these ones together with the plugin dll, however, it doesn't work.

Since is C++, you need on "extern" on each exported function of the DLL:


extern "C" __declspec( dllexport ) SomeFunction (...) {}

I guess NSISFunction is defined somewhere (in plugin.h?) as extern "C" blabla.

What happens when you compile the exdll example which comes with NSIS?
Can you load that plugin?


actually extern "C" is not needed.
I use the following without problems:

#define NSISFunction(funcname) void __declspec(dllexport) funcname(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra)