scully13
20th April 2004 16:17 UTC
Dependent DLL Question
I had a big problem which I seem to have a work around for. Now I'm wondering if I've been doing something wrong. I have 2 DLLs. DLL A is dependent on DLL B. I wrote DLL A but I only downloaded and compiled DLL B. The problem is that if I call a SetOutPath anywhere in my NSI script before I use DLL A it won't work. I get this error in the install.log file: "Error registering DLL: Could not load C:\yada\yada\DLLA.dll". If I remove the SetOutPath or add a SetOutPath $PLUGINSDIR before my Call to DLL A I'm ok. Is there something else I can do so that I don't have to add the extra SetOutPath before every call to my DLL A?
Both files are always in the plugins directory like they should be. I also did some testing with other DLLS like advsplash.dll and it's fine. If I strip my DLL down so that it doesn't need the dependency it's ok. So, It must be that my DLL has a dependent.
Joost Verburg
20th April 2004 18:45 UTC
Advsplash is an NSIS plug-in which does not have to be registered.
I assume you need the DLL only temporary, so why don't you create a NSIS plug-in or a DLL that doesn't have to registered?
RegDLL uses the path set by SetOutPath. If DLL B is in $PLUGINSDIR, the directory should be set to $PLUGINSDIR. You only have to add SetOutPath before registering the DLL.
scully13
20th April 2004 19:20 UTC
I don't think either DLL needs to be registered. I've been using them for over a year and we never regsitered them before so I think that's ok. However, if there is something I can check to see if it needs to be registered I'll check it out.
DLL A is an NSIS plug-in but DLL B is not. DLL B is some of the boost library functions from boost.org.
I guess for now I'll just make sure I use "SetOutPath $PLUGINSDIR" before I call DLL A. Maybe later I'll try and merge the boost stuff in. Thanks,
scully13
20th April 2004 19:23 UTC
Here is my test code if anybody sees anything stupid I'm doing wrong.
Name "Example1"
OutFile "setup.exe"
InstallDir "$PROGRAMFILES\Example1"
ReserveFile "${NSISDIR}\Plugins\boost.dll"
Function .onInit
InitPluginsDir
SetOutPath $PLUGINSDIR
File "${NSISDIR}\Plugins\boost.dll"
FunctionEnd
Section "Section" sec
SetOutPath "$INSTDIR" ; this breaks it.
;SetOutPath $PLUGINSDIR ; putting this in makes it work.
File "${NSISDIR}\makensis.exe"
util::test
;exdll::myFunction
SectionEnd
Joost Verburg
20th April 2004 20:44 UTC
Right, I thought it was not a NSIS plug-in because you are registering it. This DLL does not have to be registered.
It is indeed true that you should set the current folder to $PLUGINSDIR if the DLL is linked to another DLL.
You can create a macro or load the the second DLL dynamically.