How to use DLLs with dependencies at install AND uninstall time in Inno Setup?

帅比萌擦擦* 提交于 2020-12-04 04:04:14

问题


I want to import two dlls in my .iss when uninstalled the app. I cannot find a way to do this.

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

procedure Uninstalled();
external 'Uninstalled@{app}\StatisticInstallInfo.dll cdecl  uninstallonly';

I want import adcore.dll in procedure Uninstalled too. And it's failed as below shows;

[Files]
Source: {#MyDefaultPackDir}\adcore.dll; DestDir: "{app}"
Source: {#MyDefaultPackDir}\StatisticInstallInfo.dll; DestDir: "{app}"
[Code]
procedure Uninstalled();
external 'Uninstalled@files:StatisticInstallInfo.dll,adcore.dll cdecl  uninstallonly';

It does not work.

Installed() and Uninstalled() are in the StatisticInstallInfo.dll, which depends on adcore.dll.


回答1:


When the installer is running, Inno has access to the contents of the setup, and so can extract any files needed using the files:file1.dll,file2.dll syntax.

At uninstall time, Inno no longer as access to the contents of the setup so it needs to rely on anything you extracted at install time using a normal [Files] entry. Because of this, it no longer cares about the dependencies and leaves that up to you.

[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';

Depending on when you call that function (if after the install itself) you can scrap the files:... syntax and just use {app}\StatisticInstallInfo.dll in both cases.



来源:https://stackoverflow.com/questions/12582153/how-to-use-dlls-with-dependencies-at-install-and-uninstall-time-in-inno-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!