I made a simple tool (LogAndMailApplication) that sends logs to my gmail account, for this I used the Indy component TIdSSLIOHandlerSocketOpenSSL. To work it needs ssleay32.dll and libeay32.dll.
So at application start I extract from exe resources the 2 dll and I copy them to the application folder.
All the indy compoennts are in a datamodule I destroy before closing the application.
After destroying the datamodule I try to delete the dlls but I cannot.
I just used DeleteFile, but that worked great for all the other files I delete on application exit (incluging an ini file).
I tried to make a simple exe that just deletes the 2 dll and it works. So the problem is that the 2 dll are somehow locked until the LogAndMailApplication is not closed, how to solve the problem?
You can do the following: at the very end of your code use
FreeLibrary(GetModuleHandle(‘ssleay32.dll’));
FreeLibrary(GetModuleHandle(‘libeay32.dll’));
DeleteFile(PathToDLL1);
DeleteFile(PathToDLL2);
This should work.
Alternatively you can get rid of OpenSSL and use SSL components from our SecureBlackbox.