Installing missing dlls in Windows for SOFA Statistics

Creating a Windows installation package that works on everything from XP Home Edition to Vista 64-bit Business Edition is manageable but not exactly trivial.  Sometimes a single file can create a lot of issues e.g. msvcr71.dll (See http://www.sofastatistics.com/blog/?p=113). To ensure this file is available on the target computer it is not simply a matter of transferring the file in the same way that other files are transferred.  The correct approach using NSIS is to run InstallLib.

The following item was helpful – http://blacksheepsoftware.com.au/bradley/wordpress/?p=17. The NSIS documentation of relevance is here – http://nsis.sourceforge.net/Docs/AppendixB.html.

The snippet of code used in the latest SOFA Statistics package for Windows is:

; http://nsis.sourceforge.net/Docs/AppendixB.html
IfFileExists "$PROGRAMFILES\sofa\start.pyw" 0 new_installation

StrCpy $ALREADY_INSTALLED 1

new_installation:

!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED “G:\3 SOFA dev\sofalibs\msvcr71.dll” $SYSDIR\msvcr71.dll $SYSDIR

Comments are closed.