FreeLibrary hanging forever
I'm using a dll that doesn't belong to me and i don't have the source code
of the dll.
Everything works fine with that dll except when I call FreeLibrary when i try
to exit my app, it hangs there forever and my app get stuck in the memory....
Is there a way to skip the unload of the dll ? I try to skip the call "FreeLibrary"
but it won't help, the system seems still try to unload the dll.
THanks for any help on this.
Re: FreeLibrary hanging forever
How bout a sample app which just does a LoadLibrary and FreeLibrary ? Do u see the same observation ?
Note: When process exits,all libraries will be unloaded, no matter what.
Re: FreeLibrary hanging forever
Well....maybe the dll runs into a deadlock or similar while cleaning up...however, without the source not that easily traceable...
Re: FreeLibrary hanging forever
Thanks for the replies...
That is my real problem now, because i don't have the source code of the dll,
i only have the dll binary itself......The sample also hangs...
Is there any way for my app to exit without waiting for the dll unloading ?
Re: FreeLibrary hanging forever
Unload the DLL's you care about. Clean up your resources then call TerminateProcess(...) on yourself.
You should at least try and see what is happening by using the symbol server and stepping into the disassembly Look at the exports of the dll maybe you need to call some de-init function [for whatever reason]. If you can contact the developer(s) of the dll.
symbol server:
http://msdn.microsoft.com/library/de...mbolserver.asp
Re: FreeLibrary hanging forever
Yes, terminateprocess works.....but i don't know if it will cause any problem.
At least my app is terminated right away.
THank you very much for the help.
Re: FreeLibrary hanging forever
Quote:
Originally Posted by tim24
Yes, terminateprocess works.....but i don't know if it will cause any problem.
At least my app is terminated right away.
THank you very much for the help.
That is why I said to clean up any dlls you need to by explicitly calling FreeLibrary(...) on them [however many times you need] and to clean up any resources that you may have. TerminateProcess(...) bypasses notifying Dll's that the process is exiting.
I woud not leave this as it is [but you asked]. I would seek an answer as to why the Dll is blocking.
TerminateProcess