Skip to content

Latest commit

 

History

History
53 lines (36 loc) · 1.73 KB

FreeLibrary.md

File metadata and controls

53 lines (36 loc) · 1.73 KB

Home

Function name : FreeLibrary

Group: Dynamic-Link Library - Library: kernel32


The FreeLibrary function decrements the reference count of the loaded dynamic-link library (DLL). 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


Code examples:

Using LoadLibrary
Loading a string resource from an executable file
Storing registration key in the resources of an executable file
How to display a user-defined icon in the MessageBox dialog
Exporting DLL icon resources as .ICO files

Declaration:

BOOL FreeLibrary(
  HMODULE hModule   // handle to DLL module
);  

FoxPro declaration:

DECLARE INTEGER FreeLibrary IN kernel32;
	INTEGER hLibModule  

Parameters:

hModule [in] Handle to the loaded DLL module. The LoadLibrary or GetModuleHandle function returns this handle.


Return value:

If the function succeeds, the return value is nonzero


Comments:

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.