Format
#include <stdlib.h> int _loadmod(char *module_name, unsigned long *module_handle);
Language Level: Extension
_loadmod loads a dynamic link library (DLL) for the calling
process. The module_name is the name of the DLL to be
loaded, and the module_handle is the file handle
associated with the DLL.
Note: On OS/2, _loadmod and _freemod perform exactly the
same function as the OS/2 APIs DosLoadModule and DosFreeModule.
They are provided for compatibility only with earlier releases of
the C/C++ run-time library, and will not be supported in future
versions. Use DosLoadModule and DosFreeModule instead. For more
details on these APIs, see the Control Program Guide and
Reference.
Note: _loadmod and _freemod, on Windows, perform exactly
the same function as the Windows APIs LoadLibrary and
FreeLibrary. They are provided for compatibility only with
earlier releases of the C/C++ run-time library, and will not be
supported in future versions. Use LoadLibrary and FreeLibrary
instead. For more details on these APIs, see the Win32
Programmer's Reference.
If the
operation is successful on OS/2, _loadmod returns the handle of
the loaded DLL to the calling process. The process can use this
handle with the OS/2 API DosQueryProcAddr to get the address of
the required function from within the DLL. Once the reference is
established, the calling process can then call the specific
function.
On
Windows, if the operation is successful, _loadmod returns the
handle of the loaded DLL to the calling process. The process can
use this handle with the Win32 API GetProcAddress to get the
address of the required function from within the DLL. Once the
reference is established, the calling process can then call the
specific function.
Return Value
_loadmod returns 0 if the DLL was successfully loaded.
If unsuccessful, _loadmod returns -1, and sets errno to one of
the following values:
| Value | Meaning |
| EMODNAME | The specified module_name is not valid. |
| EOS2ERR | A system error occurred. Check _doserrno for the specific error code. |
![]()
_freemod -- Free User DLL
<stdlib.h>
/Ge compiler option