Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function decrements the reference count of a loaded dynamic-link library (DLL) by one, and then calls ExitThreadto terminate the calling thread.

The function gives threads that are created and executed within a DLL an opportunity to safely unload the DLL and terminate themselves.

Syntax

VOID FreeLibraryAndExitThread(
  HMODULE 
hModule,
  DWORD 
dwExitCode
);

Parameters

hModule

[in] Handle to the DLL module whose reference count the function decrements.

The LoadLibraryor GetModuleHandlefunction returns this handle.

dwExitCode

[in] Specifies the exit code for the calling thread.

Return Value

None. Invalid hModulehandles are ignored.

Remarks

The FreeLibraryAndExitThreadfunction is implemented as follows:

Copy Code
FreeLibrary(hModule);
ExitThread(dwExitCode);

Requirements

Header winbase.h
Library coredll.dll
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also