views:

90

answers:

1

I have a helper DLL and a function I call at the end of my setup script. I only want to run it depending on the operating system version.

I include the following lines in the code section:

function CompleteInstall(szInstallPath: String) :  Integer;
external 'CompleteInstall@files:InstallHelper.dll cdecl setuponly';

I've written a function to prevent the DLL from being extracted adding "Check: IsXPorHigher" to the Source statement for the DLL in the [Files] section.

It appears that when the setup program begins it attempt to resolve the external function due to the external statement, causing a runtime error (Cannot import...) because my DLL relies on a function that is not available on older OS's.

Can I conditionally declare the function in the script or does this require a separate installer for older versions of the OS? I'm trying hard to maintain just one script for all scenarios.

+3  A: 

Have you tried using the delayload option? Refer to the Using DLLs section in the Inno Setup documentation, under Pascal Scripting.

function CompleteInstall(szInstallPath: String) : Integer;
external 'CompleteInstall@files:InstallHelper.dll cdecl setuponly delayload';
ChrisN
Excellent. Thanks for the tip.
AlanKley