Jump to content

DosFreeModule: Difference between revisions

From EDM2
Line 57: Line 57:
===See Also===
===See Also===


[[OS2 API:DosLoadModule|DosLoadModule]], [[OS2 API:DosQueryProcAddr|DosQueryProcAddr]]
[[OS2 API:CPI:DosLoadModule|DosLoadModule]], [[OS2 API:CPI:DosQueryProcAddr|DosQueryProcAddr]]


[[Category:The OS/2 API Project]]
[[Category:The OS/2 API Project]]

Revision as of 00:12, 17 May 2016

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