PRB: FreeLibrary() Fails When Called Within DLL_PROCESS_DETACH CodeID: Q214784
|
In Windows 98, FreeLibrary() will return FALSE if it is called within the DLL_PROCESS_DETACH code of DllMain().
Never call LoadLibrary() or FreeLibrary() within DllMain(). These calls can create dependency loops and result in thread deadlock. This has always been the case and is made clear within the Warning section in the online documentation for DllMain().
In Windows 95, the operating system made no attempt to enforce this DLL serialization rule. Hence, an unsafe call to FreeLibrary() within DllMain() would return TRUE. Windows 98 returns FALSE for such a call in order to more strictly enforce this rule. This may cause problems for pre-existing code that did not heed the warning.
This behavior is by design.
Additional query words:
Keywords : kbDLL kbKernBase
Version : winnt:
Platform : winnt
Issue type : kbprb
Last Reviewed: April 15, 1999