If you want separate uninstallers, you have to write separate installers. The general rule is you have to write a separate installer per application.
This said, you can have any number of shared files, which can be dll's, executables, etc. that are shared between distinct applications.
Windows have well defined procedures to keep track of shared files, with a reference count. The reference count is incremented by the installer and decremented by the uninstaller. The files are removed from the system only if the reference count reach 0 during uninstallation.
You use the sharedfile
flag to instruct the installer the file is shared. The MyLib.dll file is shared in the following example:
[Files]
Source: "MyProg.exe"; DestDir: "{app}"
Source: "MyProg.chm"; DestDir: "{app}"
Source: "MyLib.dll"; DestDir: "{sys}"; Flags: sharedfile
Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
From the documentation (emphasis mine):
sharedfile
Specifies that the file is shared among multiple applications, and should only be removed at uninstall time if no other applications are using it. Most files installed to the Windows System directory should use this flag, including .OCX, .BPL, and .DPL files.
Windows' standard shared file reference-counting mechanism (located in the registry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs) is used to keep track of how many applications depend on the file. Each time the file is installed, the reference count for the file is incremented. (This happens regardless of whether the installer actually replaces the file on disk.) When an application using the file is uninstalled, the reference count is decremented. If the count reaches zero, the file is deleted (with the user's confirmation, unless the uninsnosharedfileprompt
flag is also specified).
sharedfile
flag on the shared files (in both setups), causing Inno to only remove them once they're finsihed with. – Deanna