DosFreeModule

From EDM2
Revision as of 22:12, 16 May 2016 by Martini (Talk | contribs)

Jump to: navigation, search

DosFreeModule

Syntax

rc = DosFreeModule( hMod );

Parameters

HMODULE hMod (input)
Handle for the module to be freed (from DosLoadModule).

Returns

APIRET rc
Indicates if any error occurred.
0 NO_ERROR
6 ERROR_INVALID_HANDLE
12 ERROR_INVALID_ACCESS
95 ERROR_INTERRUPT

Include Info

  1. define INCL_DOSMODULEMGR
    #include <os2.h>

Usage Explanation

DosFreeModule frees the reference to the dynamic link module for this process and if the dynamic link module is not used by any other process the memory occupied by the module is freed. This means that no functions in the dynamic link module can be used any longer.

Relevant Structures

Gotchas

Sample Code

HMODULE hmod;
APIRET rc=0;

/* Load DLL with DosLoadModule */

/* Free DLL */
rc = DosFreeModule(hmod);
if(rc) {  /* Not success? */
   printf("Error. Cannot free the DLL. DosFreeModule returned %d.\n",rc);
   return(-1);
}

See Also

DosLoadModule, DosQueryProcAddr