mardi 13 octobre 2009

NSIS - Create a C/C++ Plugin (NSIS DLL) using external DLL function calls

Issue:
Trying to compile a NSIS script using a custom plugin (NSIS DLL) which should be able to use an external DLL functions, I faced some troubles: my script compiled but nothing happened each time my plugin called my external DLL fucntions. 

Reason :
As my plugin needed the external LIB file to compile correctly, my NSIS script needed NSIS to know this external DLL as well. Copying the NSIS DLL file into the NSIS program folder was not sufficient.

Solution:
Before copying the NSIS DLL into C:\Program Files\NSIS\Plugins
I needed to indicate my NSIS compiler which dll to include before compiling the script.
This operation must be done in the .onInit function


Function .onInit
    initpluginsdir
   file /oname=$PLUGINSDIR\libcurl.dll "libcurl.dll"
    file /oname=$PLUGINSDIR\pacparser.dll "pacparser.dll"
    file /oname=$PLUGINSDIR\nspr4.dll "nspr4.dll"
    file /oname=$PLUGINSDIR\js3250.dll "js3250.dll"
    file /oname=$PLUGINSDIR\mozcrt19.dll "mozcrt19.dll"

...

...
...       
FunctionEnd

Aucun commentaire:

Enregistrer un commentaire