|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
FreeLibrary and AfxFreeLibrary
Processes explicitly linking to a DLL call the FreeLibrary function when the DLL module is no longer needed. This function decrements the module's reference count and, if the reference count is zero, unmaps it from the address space of the process.
MFC applications should use AfxFreeLibrary instead of FreeLibrary to unload an extension DLL. The interface (function prototype) for AfxFreeLibrary is the same as FreeLibrary.