Remove library after unloading
Hi all,
I am trying to make an application (for windows) which can be updated by replacing the dll library at run-time, problem is that the exe seems to keep the dll file locked after unloading.
What I'm trying to do in code:
Code:
if(!Lib->load()) {
qDebug() << mainLib->errorString();
}
...
if( Lib->unload() ) {
delete Lib;
QFile::remove(libraryPath
) //fails as file is locked :( }
I've checked that the dll file is closed (process monitor, sysinternals) when trying to remove.
Does anybody know if this is something which can't be done by qLibrary, a Windows probem or whether an app restart is required?
Re: Remove library after unloading
Found the answer, I wasn't dynamically loading the dll's. Used the option 'delay loaded dll's' in visual studio.