This is part of Family API which allow to create dual-os version of program runs under OS/2 and DOS
Note: This is legacy API call. It is recommended to use 32-bit equivalent
This call loads a dynamic link module and returns a handle for the module.
DosLoadModule (ObjNameBuf, ObjNameBufL, ModuleName, ModuleHandle)
rc (USHORT) - return:Return code descriptions are:
If the file is an OS/2 dynamic link module, it is loaded, and a handle is returned. This handle is used for freeing the dynamic link module with a DosFreeModule request, getting procedure addresses with DosGetProcAddr requests, and getting the fully qualified file name with a DosGetModName request.
DosLoadModule may not be called from a dynamic library initialization routine if the module to be loaded or any module referenced by it contains a dynamic link library initialization routing.
#define INCL_DOSMODULEMGR USHORT rc = DosLoadModule(ObjNameBuf, ObjNameBufL, ModuleName, ModuleHandle); PSZ ObjNameBuf; /* Address of object name buffer */ USHORT ObjNameBufL; /* Length of object name buffer */ PSZ ModuleName; /* Address of module name string */ PHMODULE ModuleHandle; /* Address of module handle (returned) */ USHORT rc; /* return code */
EXTRN DosLoadModule:FAR INCL_DOSMODULEMGR EQU 1 PUSH@ OTHER ObjNameBuf ;Object name buffer (returned) PUSH WORD ObjNameBufL ;Length of object name buffer PUSH@ ASCIIZ ModuleName ;Module name string PUSH@ WORD ModuleHandle ;Module handle (returned) CALL DosLoadModule Returns WORD
This example loads a module.
#define INCL_DOSMODULEMGR #define MODULE_NAME "abcd" #define FULL_MODULE_NAME "\\nifty\\abcd.dll" CHAR LoadError[100]; HMODULE ModuleHandle; USHORT rc; if (DosLoadModule(LoadError, /* Object name buffer */ sizeof(LoadError), /* Length of object name buffer */ MODULE_NAME, /* Module name string */ &ModuleHandle) == 2) /* Module handle */