FreeLibraryAndExitThread (Compact 2013)

3/28/2014

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

See Also

Reference

DLL Functions
FreeLibrary
ExitThread
LoadLibrary
DisableThreadLibraryCalls