如何在 Inno Setup 中在安装和卸载时使用具有依赖项的 DLL?

use*_*491 3 dll inno-setup pascalscript

我想在卸载应用程序时在我的 .iss 中导入两个 dll。我找不到办法做到这一点。

procedure Installed();
external 'Installed@files:StatisticInstallInfo.dll,adcore.dll cdecl  setuponly ';

procedure Uninstalled();
external 'Uninstalled@{app}\StatisticInstallInfo.dll cdecl  uninstallonly';
Run Code Online (Sandbox Code Playgroud)

我也想adcore.dll在程序中导入Uninstalled。它失败了,如下所示;

[Files]
Source: {#MyDefaultPackDir}\adcore.dll; DestDir: "{app}"
Source: {#MyDefaultPackDir}\StatisticInstallInfo.dll; DestDir: "{app}"
Run Code Online (Sandbox Code Playgroud)
[Files]
Source: {#MyDefaultPackDir}\adcore.dll; DestDir: "{app}"
Source: {#MyDefaultPackDir}\StatisticInstallInfo.dll; DestDir: "{app}"
Run Code Online (Sandbox Code Playgroud)

这是行不通的。

Installed()并且Uninstalled()在 中StatisticInstallInfo.dll,这取决于adcore.dll

Dea*_*nna 6

当安装程序运行时,Inno 可以访问安装程序的内容,因此可以使用files:file1.dll,file2.dll语法提取所需的任何文件。

在卸载时,Inno 不再访问安装程序的内容,因此它需要依赖您在安装时使用普通[Files]条目提取的任何内容。正因为如此,它不再关心依赖关系,而把它留给你。

[Files]
Source: "StatisticInstallInfo.dll"; DestDir: "{app}"
Source: "adcore.dll"; DestDir: "{app}"

[Code]
procedure Installed();
external 'Installed@files:StatisticInstallInfo.dll,adcore.dll cdecl setuponly';

procedure Uninstalled();
external 'Uninstalled@{app}\StatisticInstallInfo.dll cdecl uninstallonly';
Run Code Online (Sandbox Code Playgroud)

根据您调用该函数的时间(如果在安装之后),您可以废弃files:...语法并仅{app}\StatisticInstallInfo.dll在两种情况下使用。