简体   繁体   English

Windows 7下的Inno Setup 5.5.4(a)错误为“无法导入dll”

[英]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. 我需要用几个dll来做一个serup应用程序:在pas脚本中,使用了compinstkey.dll,它调用了aspr_ide.dll。 I did in the iss-script: 我在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:...\\Temp\\tp.GHPtmp\\aspr_ide.dll". 在Windows XP中可以正常工作,但Windows7确实会引发错误“无法导入dll:C:... \\ Temp \\ tp.GHPtmp \\ aspr_ide.dll”。 At the pause of installation the aspr_ide.dll in this moment exist at the "C:...\\Temp\\tp.GHPtmp\\". 在安装暂停时,此时的aspr_ide.dll位于“ C:... \\ Temp \\ tp.GHPtmp \\”中。

What do I wrong? 我怎么了 Why dont run under Windows 7? 为什么不在Windows 7下运行? How can I correct it? 我该如何纠正?

You should use the delayload keyword on your function declarations like: 您应该在函数声明上使用delayload关键字,例如:

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 . 延迟加载导致安装程序仅在调用DLL时加载,而不是在启动时加载DLL,如http://www.jrsoftware.org/ishelp/index.php?topic=scriptdll所述

First, I suggest you update Inno to version 5.5.9, which has the fewest bugs. 首先,我建议您将Inno更新到5.5.9版,该版本的bug最少。 Second, recompile the DLL on the Win7 system because DLLs may not be the same in the XP and Win7 dependent dynamic libraries. 第二,重新编译Win7系统上的DLL,因为DLL在依赖于XP和Win7的动态库中可能不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM