I am newbie of NSIS installer. I gotta say NSIS deployment is awesome . but lately I am encountered a problem.
I am using NSIS script to call let's say A.dll which compiled using Visual C++ and export some C functions. and A.dll import B.dll. So I extract them (A.dll and B.dll) to $PLUGINSDIR at the very beginning of installation.
After that I call System::call to call let's say "test()" of A.dll. but it always return "error". I also did a test removing import of B.dll and "test()" works and returns the value of what I expected.
here is the code:
;extract dll file
InitPluginsDir
SetOutPath $PLUGINSDIR
File "A.dll"
File "B.dll"
...........
;call it
code:
System::Call "$PLUGINSDIR\A::test() i.r0"
$0 return "error"
after removing import of B.dll and re-compile A.dll. test() works fine.
Can anybody explain How can I call a dll that imports another dll using NSIS system plugin? Thanks in advance. sorry for the poor English. hope you guys understand what I mean.
The loader cannot find B.dll so LoadLibrary (called by system.dll) on A.dll is going to fail.
You can set the working directory:
Push $outdir ; Save current, not required
SetOutPath $pluginsdir
System::Call "$PLUGINSDIR\A::test() i.r0"
pop $outdir
SetOutPath $outdir ; Restore
or you can load B.dll yourself:
System::Call 'KERNEL32::LoadLibrary(t "$PLUGINSDIR\B.dll")i.s'
System::Call "$PLUGINSDIR\A::test() i.r0"
System::Call 'KERNEL32::FreeLibrary(is)'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.