10 dlopen(char *path, int mode)
13 char tmp[260], *beg, *dot;
17 if ((rc = DosLoadModule(fail, sizeof fail, path, &handle)) == 0)
18 return (void *)handle;
22 /* Not found. Check for non-FAT name and try truncated name. */
23 /* Don't know if this helps though... */
24 for (beg = dot = path + strlen(path);
25 beg > path && !strchr(":/\\", *(beg-1));
31 memmove(tmp, path, n);
32 memmove(tmp+n, dot, strlen(dot)+1);
33 if (DosLoadModule(fail, sizeof fail, tmp, &handle) == 0)
34 return (void *)handle;
41 dlsym(void *handle, char *symbol)
47 rc = DosQueryProcAddr((HMODULE)handle, 0, symbol, &addr);
49 rc = DosQueryProcType((HMODULE)handle, 0, symbol, &type);
50 if (rc == 0 && type == PT_32BIT)
52 rc = ERROR_CALL_NOT_IMPLEMENTED;
66 if (DosGetMessage(NULL, 0, buf, sizeof buf - 1, retcode,
67 "OSO001.MSG", &len)) {
70 "OS/2 system error code %d, possible problematic module: '%s'",
73 sprintf(buf, "OS/2 system error code %d", retcode);
76 if (len && buf[len - 1] == '\n')
78 if (len && buf[len - 1] == '\r')
80 if (len && buf[len - 1] == '.')
82 if (fail[0] && len < 300)
83 sprintf(buf + len, ", possible problematic module: '%s'",