Inno Setup uninstaller not deleting folder containing DLLs

I am new to Inno Setup, so I am grateful for the sample script that Xojo provides in the Xojo Documentation, “User Guide: Inno Setup Script (32-bit apps)”. The sample script worked perfectly for the installation of my desktop app in Windows 11 (I am a Microsoft Windows Beta Tester).

My issue is with the uninstall program that the sample script creates. The Inno Setup Uninstaller does not delete the “Libs” folder in the application directory, containing the DLLs, that was created by the installer. This leaves the end user with the unpleasant task of having to manually delete the Libs folder and the application folder.

I am assuming that the uninstaller did not delete the Libs folder because the DLLs in the folder were running at the time of the uninstall.

The Inno Setup Documentation discusses a procedure named “UnloadDLL”, however it also remarks that “if you attempt to call a function in a DLL that has been unloaded, the DLL will be re-loaded”.

Is there a way, in Inno Setup, to loop through the active DLLs in the Libs folder, unload them and finally delete them, so that the uninstall program can properly delete the Libs folder and the application folder?

Not the best example :stuck_out_tongue_winking_eye:

To avoid problems:

  1. Use the option in the Xojo IDE to Include the runtime DLLs
  2. Make an entry for each file instead of wildcards
  3. Use the uninsrestartdelete flag to delete files after a restar if they were in use

Extra: You can use a pascal script to check if the app is running and ask the user to close it before unistalling/reinstalling