1
/* $Id: dlfcn.c,v 1.3 1999/12/30 22:08:15 fnevgeny Exp $ */
3
/* Implementation of dlopen() interface for OS/2 */
4
/* This code is released into public domain */
11
/* We only need parts of the whole OS/2-specific stuff */
12
#define INCL_DOSMODULEMGR /* Module Manager values */
13
#define INCL_DOSERRORS /* Error values */
16
/* to get constants and check prototypes */
20
#define MAXDLLOPEN 256
22
static int LoadErrorFlag = FALSE;
23
UCHAR LoadError[LM_LENGTH] = ""; /* this is being referenced from outside
27
void *dlopen( const char *filename, int flag)
33
rc = DosLoadModule( LoadError,
40
"DosLoadModule(\"%s\") = %lu\n", filename, rc);
44
LoadErrorFlag = FALSE;
45
return (void*)DLLHandle;
57
LoadErrorFlag = FALSE;
63
void *dlsym(void *handle, char *symbol)
69
rc = DosQueryProcAddr( (HMODULE) handle,
77
case ERROR_INVALID_HANDLE:
80
"DosQueryProcAddr(\"%s\")=ERROR_INVALID_HANDLE (%lu)\n",
84
case ERROR_ENTRY_IS_CALLGATE:
87
"DosQueryProcAddr(\"%s\")=ERROR_INVALID_HANDLE (%lu)\n",
94
"DosQueryProcAddr(\"%s\")=%lu\n", symbol, rc);
97
} /* end switch(rc) */
102
LoadErrorFlag = FALSE;
103
return (void*)FuncAddress;
108
int dlclose( void *handle )
113
rc = DosFreeModule( (HMODULE)handle );
117
"DosFreeModule()=%lu\n", rc);
118
LoadErrorFlag = TRUE;
121
LoadErrorFlag = FALSE;