Skip to content
⌘ NSIS Forum Archive

How can i call a dll that import another dll using NSIS system plugin

2 posts

tunpishuang#

How can i call a dll that import another dll using NSIS system plugin

Hey guys, 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 alway return "error". I also did a test removing import of B.dll and "test()" works and return the value of what I expected.

here is the code:

;extract dll file
InitPluginsDir
SetOutPath $PLUGINSDIR
File "A.dll"
File "B.dll"
...........

;call it
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 import another dll using NSIS system plugin. Thanks in advance. sorry for the poor English. hope you guys understand what I mean.
Afrow UK#
Make sure the current/working directory is set to $PLUGINSDIR before calling your DLL (i.e. use SetOutPath $PLUGINSDIR) otherwise it won't find the other DLL.

You can control the specific location from which any given DLL is loaded by specifying a full path. If you don't use that method, then the system searches for the DLL at load time as described in this topic.


Stu