Take a standard Windows application. It loads a DLL using LoadLibrary to call a function in it (we’ll call this DLL_A). That function loads another DLL (we’ll call it DLL_B). The application now unloads the DLL_A DLL using FreeLibrary as it no longer requires it.
The question is: Is DLL_B still in memory and loaded?
Is this something I can depend upon, or is it undocumented?
No.
DLL_Bwill not be unloaded. TheLoadLibrary()call made byDLL_Awill increment the load count forDLL_B. Since there is no correspondingFreeLibrary()call forDLL_B, the refcount will not go to zero.From the LoadLibrary() docs: