Handmade Hero»Forums»Code
2 posts
Windows preventing game code dll unloading
Edited by MrPr3sident on
Hi there,

I just wanted to spread awareness about a problem I had while coding along the live code editing episodes just in case others are having trouble with this like I had.
The problem is that the game code DLL doesn't get unloaded when calling FreeLibrary().

This is actually caused by windows creating a registry entry. It can be found at HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers and has the form IgnoreFreeLibrary<YourDLLName>. And this entry does exactly what it says, ignoring your FreeLibrary call on that DLL. If you delete it, everything is working as intended.

Thanks windows

Best regards,
MrPr3sident
Mārtiņš Možeiko
2562 posts / 2 projects
Windows preventing game code dll unloading
More interesting question is who and when added this registry entry? Does it gets added always or only on special event?
2 posts
Windows preventing game code dll unloading
Edited by MrPr3sident on
Those flags are usually set by the Application Compatibility Wizard that may appear after a program exits with an error.


Sadly, this is the only thing I can find concerning this issue. (Apart from a pissed off game developer on twitter)