Archive: System:Call works only on dev machine


System:Call works only on dev machine
  Hi All,

I'm using System::Call to call a custom dll during the installation. It works fine on my machine, but when I try to install on another machine the dll doesn't get called.

Any ideas?

My code:


SetPluginUnload alwaysoff

SetOutPath "$PLUGINSDIR"
>File MyDll.dll
>; Put something in $R0
System
::Call "MyDll::myFunction(m ${R0}) v"
>SetPluginUnload manual
>
BTW

The installer packs the dll, but where is it taking it from?

Thanks,
Shlomi

You may have to supply the path to the dll in the call, like:
System::Call "$PLUGINSDIR\MyDll::myFunction(m ${R0}) v"

As for the compiler, it takes the files from the same directory as the nsi file, unless you specify a different working directory (not even sure if that's possible, actually).


Hi MSG,

Thanks for you reply. I tried:
System::Call "$PLUGINSDIR\MyDll::myFunction(m ${R0}) v"

It still doesn't work on the machine I'm testing on.

Any way of debugging it or watching a log file of the installation?

Thanks,
Shlomi


You should make sure the dll can be loaded, check the dll on the _failing_ machine with http://www.dependencywalker.com

As far as using a plugin goes, just stick it somewhere nsis can find it (nsis plugin dir or !addpluginsdir), then you don't need to supply a full path or even include it with File

Your system syntax is also wrong unless you have a define named R0, you probably want (m R0) or (m .R0), not sure if you are using R0 as input or output


Well, my dll depends on MSVCR90.DLL, so it might be this.

How should I include it in my installation?


I tried adding the C/C++ runtime dlls (including MSVCR90.DLL), but my dll is still not called.

If there is a dependency missing why don't I get any error message?


you have to install that stupid runtime, you can't just copy the dlls (or better yet, build your dll without linking to them (static link or don't use CRT at all))


I test the dll on the "failing" machine with dependecy walker.

Here is the result:

Error: The Side-by-Side configuration information for "c:\documents and settings\markz\local settings\temp\nsud1.tmp\MYDLL.DLL" contains errors. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem (14001).

Error: At least one required implicit or forwarded dependency was not found.

I see that the missing dlls are some debug CRT dlls.
This is weird because I build in Release.

Any ideas?


Like I said in my previous post, static link or don't use the CRT at all