void FreeLibrary(hinst) | |||||
HINSTANCE hinst; | /* handle of loaded library module | */ |
The FreeLibrary function decrements (decreases by one) the reference count of the loaded library module. When the reference count reaches zero, the memory occupied by the module is freed.
hinst
Identifies the loaded library module.
This function does not return a value.
A dynamic-link library (DLL) must not call the FreeLibrary function within its WEP function (Windows exit procedure).
The reference count for a library module is incremented (increased by one) each time an application calls the LoadLibrary function for the library module.
The following example uses the LoadLibrary function to load TOOLHELP.DLL and the FreeLibrary function to free it:
HINSTANCE hinstToolHelp = LoadLibrary("TOOLHELP.DLL");
if ((UINT) hinstToolHelp > 32) {
.
. /* use GetProcAddress to use TOOLHELP functions */
.
}
else {
ErrorHandler();
}
if ((UINT) hinstToolHelp > 32)
FreeLibrary(hinstToolHelp); /* free TOOLHELP.DLL */