FreeLibraryAndExitThread

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function decrements the reference count of a loaded dynamic-link library (DLL) by one, and then calls ExitThread to 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 LoadLibrary or GetModuleHandle function returns this handle.

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

Return Value

None. Invalid hModule handles are ignored.

Remarks

The FreeLibraryAndExitThread function is implemented as follows:

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

Reference

DLL Functions
FreeLibrary
ExitThread
LoadLibrary
DisableThreadLibraryCalls