Table of Contents

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

2021/09/17 04:47 · prokushev · 0 Comments
2021/08/20 03:18 · prokushev · 0 Comments

DosLoadModule

This call loads a dynamic link module and returns a handle for the module.

Syntax

DosLoadModule (ObjNameBuf, ObjNameBufL, ModuleName, ModuleHandle)

Parameters

Return Code

rc (USHORT) - return:Return code descriptions are:

Remarks

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.

Bindings

C

#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 */

MASM

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

Example

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 */