The FreeLibrary function decrements the reference count of the loaded dynamic-link library (DLL) module. When the reference count reaches zero, the module is unmapped from the address space of the calling process and the handle is no longer valid.
BOOL FreeLibrary(
HMODULE hLibModule |
// handle to loaded library module |
); |
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Each process maintains a reference count for each loaded library module. This reference count is incremented each time LoadLibrary is called and is decremented each time FreeLibrary is called. A DLL module loaded at process initialization due to load-time dynamic linking has a reference count of one. This count is incremented if the same module is loaded by a call to LoadLibrary.
Before unmapping a library module, the system enables the DLL to detach from the process by calling the DLL’s DllEntryPoint function, if it has one, with the DLL_PROCESS_DETACH value. Doing so gives the DLL an opportunity to clean up resources allocated on behalf of the current process. After the entry-point function returns, the library module is removed from the address space of the current process.
Calling FreeLibrary does not affect other processes using the same library module.
DllEntryPoint, FreeLibraryAndExitThread, GetModuleHandle, LoadLibrary
file: /Techref/os/win/api/win32/func/src/f25_19.htm, 2KB, , updated: 2000/4/7 11:19, local time: 2024/12/25 00:07,
3.15.223.129:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.org/Techref/os/win/api/win32/func/src/f25_19.htm"> FreeLibrary</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to massmind.org! |
.