Installation 在InnoSetup中使用外部库

Installation 在InnoSetup中使用外部库,installation,inno-setup,Installation,Inno Setup,我在inno设置中使用一个外部库,我通过Stdcall调用它 [Files] Source: ZipLib.dll; DestDir: {tmp}; Flags: dontcopy ... [Code] function ReadZipEx(archivePath:String; outputPath:String; callback:longword): longword; external 'ReadZipEx@files:ZipLib.dll stdcall'; 由于库有一些依赖项,我想

我在inno设置中使用一个外部库,我通过Stdcall调用它

[Files]
Source: ZipLib.dll; DestDir: {tmp}; Flags: dontcopy
...
[Code]
function ReadZipEx(archivePath:String; outputPath:String; callback:longword): longword;
external 'ReadZipEx@files:ZipLib.dll stdcall';
由于库有一些依赖项,我想将库放在setup.exe下面的某个目录中,并在不将其添加到[文件]的情况下使用它。这有可能吗?我这样试过:

function ReadZipEx(archivePath:String; outputPath:String; callback:longword): longword;
external 'ReadZipEx@ZipLib.dll stdcall';
像这样

function ReadZipEx(archivePath:String; outputPath:String; callback:longword): longword;
external 'ReadZipEx@/subdir/ZipLib.dll stdcall';
但这只会导致错误。 我通过sherlocksoftware的InnoCallback.dll调用该库

编辑

正如特拉玛所设想的那样,我尝试了其他一些解决方案: 这将找到第一个dll,但不会找到依赖项

function ReadZipEx(archivePath:String; outputPath:String; callback:longword): longword;
external 'ReadZipEx@{src}\ZipLib.dll stdcall loadwithalteredsearchpath';
这将导致一个错误:

function ReadZipEx(archivePath:String; outputPath:String; callback:longword): longword;
external 'ReadZipEx@{src}\ZipLib.dll,ICSharpCode.SharpZipLib.dll stdcall loadwithalteredsearchpath';

由于Inno Setup二进制文件从临时文件夹运行,因此需要指定DLL库的路径。如果要将库存储在与安装二进制软件包相同的文件夹中,可以使用常量在其中展开:

[Code]
procedure DoSomething;
  external 'DoSomething@{src}\MyLib.dll stdcall';
如果希望库在同一文件夹中搜索其依赖项(当指定了绝对路径时),可以将该选项添加到其导入定义中:

[Code]
procedure DoSomething;
  external 'DoSomething@{src}\MyLib.dll stdcall loadwithalteredsearchpath';
参考文件将此选项描述为:

使用更改的搜索路径加载

指定应使用Windows标志加载DLL 使用\u更改的\u搜索\u路径加载\u,这本质上会导致加载程序 在包含DLL的目录中搜索任何依赖DLL


安装程序仍然在临时目录中搜索我的第二个dll,有没有办法避免这种情况?显式依赖项是由逗号分隔的文件名列表定义的,因此我忽略了关于它们的说明。尝试更新的建议。我无法重现您的问题。我已经创建了两个库,MyLib.dll和MyDependency.dll,并导入了
DoSomething
函数,如下面的示例所示。此函数从MyDependency.dll调用函数,没有问题。这两个库都位于安装二进制软件包中。你确定所有的图书馆都在正确的地方吗?你能像我一样创建全新的库,不使用InnoCallback作为开始吗?我会尝试一下,等我完成后再给你一个答案(欢迎使用DLL地狱!)