aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dlfcn.c8
-rw-r--r--dlfcn.h29
2 files changed, 26 insertions, 11 deletions
diff --git a/dlfcn.c b/dlfcn.c
index c5d4b3c..e13c631 100644
--- a/dlfcn.c
+++ b/dlfcn.c
@@ -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
diff --git a/dlfcn.h b/dlfcn.h
index c0d7777..a10b86a 100644
--- a/dlfcn.h
+++ b/dlfcn.h
@@ -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
50DLFCN_EXPORT void *dlopen ( const char *file, int mode ); 58/* Open a symbol table handle. */
51DLFCN_EXPORT int dlclose(void *handle); 59DLFCN_EXPORT void *dlopen(const char *file, int mode);
60
61/* Close a symbol table handle. */
62DLFCN_EXPORT int dlclose(void *handle);
63
64/* Get the address of a symbol from a symbol table handle. */
52DLFCN_EXPORT void *dlsym(void *handle, const char *name); 65DLFCN_EXPORT void *dlsym(void *handle, const char *name);
66
67/* Get diagnostic information. */
53DLFCN_EXPORT char *dlerror(void); 68DLFCN_EXPORT char *dlerror(void);
54 69
55#ifdef __cplusplus 70#ifdef __cplusplus