问题
After loading a DLL library using LoadLibrary("file.dll")
visual studio also opens and locks file.pdb
.
The problem is - the file.pdb
is kept locked even after calling FreeLibrary(...)
.
It is necessary to recompile file.dll
and reload it once again (externally, outside of MSVS, using CL.exe
), but the compilation fails because file.pdb
is still locked.
How to make Visual Studio 2015 release the file lock?
回答1:
Coincidentally I've stumbled upon a solution to this:
Go to Tools -> Options
then Debugging -> General
, then turn on Use Native Compatibility Mode
.
This fixes the issue (e.g. .pdb file is unlocked after unloading .dll now).
I've no idea why, as I can't find the documentation for Use Native Compatibility Mode
.
来源:https://stackoverflow.com/questions/38427425/how-to-force-visual-studio-2015-to-unlock-pdb-file-after-freelibrary-call