Inno Setup 5.5.4(a) under Windows 7 with mistake "cannot import dll"

I need to do one serup application with couple of dll's: In the pas-script do used compinstkey.dll which call the aspr_ide.dll. I did in the iss-script:

[Files]
Source: aspr_ide.dll; DestDir: {app};Flags: ignoreversion
Source: CompInstKey.dll; DestDir: {app}; Flags: ignoreversion
....
[Code]
....
function GetRegistrationKeys: PAnsiChar;
external 'GetRegistrationKeys@files:aspr_ide.dll stdcall';

procedure Installinfo(ApplicationName, Version, UserName, Key: PAnsiChar);
  external 'Installinfo@files:CompInstKey.dll stdcall';
....
function InitializeSetup: Boolean;

begin
 Result := False;
 ExtractTemporaryFile('aspr_ide.dll');
 ExtractTemporaryFile('CompInstKey.dll');
end;
.....

in the Windows XP it work fine, but Windows7 do throw the error "Cannot import dll: C:...Temptp.GHPtmpaspr_ide.dll". At the pause of installation the aspr_ide.dll in this moment exist at the "C:...Temptp.GHPtmp".

What do I wrong? Why dont run under Windows 7? How can I correct it?


You should use the delayload keyword on your function declarations like:

function GetRegistrationKeys: PAnsiChar;
external 'GetRegistrationKeys@files:aspr_ide.dll stdcall delayload';

procedure Installinfo(ApplicationName, Version, UserName, Key: PAnsiChar);
  external 'Installinfo@files:CompInstKey.dll stdcall delayload';

The delayload causes the setup to only load the DLL when it is called rather than at startup as documented at http://www.jrsoftware.org/ishelp/index.php?topic=scriptdll.

链接地址: http://www.djcxy.com/p/7748.html

上一篇: ASP.Net中的DllImport如何查找DLL?

下一篇: Inno Setup 5.5.4(a)在Windows 7下出现错误“无法导入dll”