Archive: .DLL Call/PLUGINSDIR - File wont delete on Installer Exit.


.DLL Call/PLUGINSDIR - File wont delete on Installer Exit.
Hi all - first off, thanks for all the hard-work and effort in creating a fantastic installer package. I love it!

I'm working on an installer that makes numerous calls to a .DLL that I've written that contains a lot of proprietary stuff. I've extracted the .DLL into the PLUGINSDIR, in hopes that when the installer dies, the .DLL disappears.

After running various tests - the .DLL still remains in the PLUGINSDIR after the installer has exited.

Is it possible there is an open file handler to the .DLL prior to the "DELETE PLUGINSDIR" call?

How can I ensure the handle is released prior to the folder being removed?

I've seen some code-snippets while searching the forum - I've tried a few, but I'm not having any luck - what do you recommend?

I believe one call I was using was System:Free 0 or something along those lines (sorry, dont have the code handy).

Suggestions?


Try changing the working directory to something other than $PLUGINSDIR with SetOutPath. However, if the dll remains then it sounds like a problem with the dll. Can you manually delete it after calling it?

Stu


Originally posted by Afrow UK
Try changing the working directory to something other than $PLUGINSDIR with SetOutPath. However, if the dll remains then it sounds like a problem with the dll. Can you manually delete it after calling it?
I never really change to the PLUGINSDIR in my script, but I took your suggestion and did a SetOutPath to $TEMP for kicks at the end of the script to see what that would do... MySetup.DLL remained in the plugins dir - the rest of the files that were used by the setup.exe disappeared.

Here's the jist of what I'm doing, some code removed:


; Initialize our plugin directory
InitPluginsDir

File /oname=$PLUGINSDIR\MySetup.DLL "${CLIENT_INSTALL_PATH}\work\Utilities\MySetup.dll"

System::Call '$PLUGINSDIR\MySetup::Function1(t "$INSTDIR", t r0r0, i r1r1 ) i .r2'


System::Call '$PLUGINSDIR\MySetup::Function2(t "$INSTDIR", t r0r0, i r1r1 ) i .r2'


System::Call '$PLUGINSDIR\MySetup::Function3(t "$INSTDIR", t r0r0, i r1r1 ) i .r2'

SetOutPath "$TEMP"



Does "System" have a handle on that .DLL that hasn't been released?

I tried to Delete the .DLL after one of the calls - it wouldn't go anywhere.. am I missing something?

add "?u" at the end of the last call


Originally posted by Anders
add "?u" at the end of the last call
That did the trick.. Is there a single call that will tell "System" to release the/all the handle(s)?