diff options
-rw-r--r-- | dlfcn.c | 8 | ||||
-rw-r--r-- | dlfcn.h | 29 |
2 files changed, 26 insertions, 11 deletions
@@ -225,10 +225,10 @@ void *dlopen( const char *file, int mode ) | |||
225 | * all symbols from the original program file, and any objects loaded | 225 | * all symbols from the original program file, and any objects loaded |
226 | * with the RTLD_GLOBAL flag. | 226 | * with the RTLD_GLOBAL flag. |
227 | * The return value from GetModuleHandle( ) allows us to retrieve | 227 | * The return value from GetModuleHandle( ) allows us to retrieve |
228 | * symbols only from the original program file. For objects loaded with | 228 | * symbols only from the original program file. EnumProcessModules() is |
229 | * the RTLD_GLOBAL flag, we create our own list later on. For objects | 229 | * used to access symbols from other libraries. For objects loaded |
230 | * outside of the program file but already loaded (e.g. linked DLLs) | 230 | * with the RTLD_LOCAL flag, we create our own list later on. They are |
231 | * they are added below. | 231 | * excluded from EnumProcessModules() iteration. |
232 | */ | 232 | */ |
233 | hModule = GetModuleHandle( NULL ); | 233 | hModule = GetModuleHandle( NULL ); |
234 | 234 | ||
@@ -30,26 +30,41 @@ extern "C" { | |||
30 | # define DLFCN_EXPORT | 30 | # define DLFCN_EXPORT |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | /* POSIX says these are implementation-defined. | 33 | /* Relocations are performed when the object is loaded. */ |
34 | * To simplify use with Windows API, we treat them the same way. | ||
35 | */ | ||
36 | |||
37 | #define RTLD_LAZY 0 | ||
38 | #define RTLD_NOW 0 | 34 | #define RTLD_NOW 0 |
39 | 35 | ||
36 | /* Relocations are performed at an implementation-defined time. | ||
37 | * Windows API does not support lazy symbol resolving (when first reference | ||
38 | * to a given symbol occurs). So RTLD_LAZY implementation is same as RTLD_NOW. | ||
39 | */ | ||
40 | #define RTLD_LAZY RTLD_NOW | ||
41 | |||
42 | /* All symbols are available for relocation processing of other modules. */ | ||
40 | #define RTLD_GLOBAL (1 << 1) | 43 | #define RTLD_GLOBAL (1 << 1) |
44 | |||
45 | /* All symbols are not made available for relocation processing by other modules. */ | ||
41 | #define RTLD_LOCAL (1 << 2) | 46 | #define RTLD_LOCAL (1 << 2) |
42 | 47 | ||
43 | /* These two were added in The Open Group Base Specifications Issue 6. | 48 | /* These two were added in The Open Group Base Specifications Issue 6. |
44 | * Note: All other RTLD_* flags in any dlfcn.h are not standard compliant. | 49 | * Note: All other RTLD_* flags in any dlfcn.h are not standard compliant. |
45 | */ | 50 | */ |
46 | 51 | ||
52 | /* The symbol lookup happens in the normal global scope. */ | ||
47 | #define RTLD_DEFAULT ((void *)0) | 53 | #define RTLD_DEFAULT ((void *)0) |
54 | |||
55 | /* Specifies the next object after this one that defines name. */ | ||
48 | #define RTLD_NEXT ((void *)-1) | 56 | #define RTLD_NEXT ((void *)-1) |
49 | 57 | ||
50 | DLFCN_EXPORT void *dlopen ( const char *file, int mode ); | 58 | /* Open a symbol table handle. */ |
51 | DLFCN_EXPORT int dlclose(void *handle); | 59 | DLFCN_EXPORT void *dlopen(const char *file, int mode); |
60 | |||
61 | /* Close a symbol table handle. */ | ||
62 | DLFCN_EXPORT int dlclose(void *handle); | ||
63 | |||
64 | /* Get the address of a symbol from a symbol table handle. */ | ||
52 | DLFCN_EXPORT void *dlsym(void *handle, const char *name); | 65 | DLFCN_EXPORT void *dlsym(void *handle, const char *name); |
66 | |||
67 | /* Get diagnostic information. */ | ||
53 | DLFCN_EXPORT char *dlerror(void); | 68 | DLFCN_EXPORT char *dlerror(void); |
54 | 69 | ||
55 | #ifdef __cplusplus | 70 | #ifdef __cplusplus |