diff options
author | Alain Frisch <alain@frisch.fr> | 2008-04-22 12:24:10 +0000 |
---|---|---|
committer | Alain Frisch <alain@frisch.fr> | 2008-04-22 12:24:10 +0000 |
commit | 291a4207ad7a34f2e59f2ecfd6e0fb14afd31c62 (patch) | |
tree | bd96989c887e8240219e2c200e5e1303290178bc /byterun/unix.c | |
parent | f3f7dd8919e61e66faaf9004fa6fc962eaf1b141 (diff) |
Cleanup natdynlink. Automatic initialization of Dynlink (bytecode and native code). Do not use RTLD_GLOBAL for Dynlink.loadfile_private in native code.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@8873 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/unix.c')
-rw-r--r-- | byterun/unix.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/byterun/unix.c b/byterun/unix.c index 00b27de74..f7e3f6326 100644 --- a/byterun/unix.c +++ b/byterun/unix.c @@ -204,7 +204,7 @@ entry_t *caml_lookup_bundle(const char *name) return current; } -void * caml_dlopen(char * libname, int for_execution) +void * caml_dlopen(char * libname, int for_execution, int global) { NSObjectFileImage image; entry_t *bentry = caml_lookup_bundle(libname); @@ -286,9 +286,9 @@ char * caml_dlerror(void) #elif defined(__CYGWIN32__) /* Use flexdll */ -void * caml_dlopen(char * libname, int for_execution) +void * caml_dlopen(char * libname, int for_execution, int global) { - int flags = FLEXDLL_RTLD_GLOBAL; + int flags = (global ? FLEXDLL_RTLD_GLOBAL : 0); if (!for_execution) flags |= FLEXDLL_RTLD_NOEXEC; return flexdll_dlopen(libname, flags); } @@ -305,7 +305,7 @@ void * caml_dlsym(void * handle, char * name) void * caml_globalsym(char * name) { - return flexdll_dlsym(flexdll_dlopen(NULL,0), name); + return flexdll_dlsym(flexdll_dlopen(NULL,0,1), name); } char * caml_dlerror(void) @@ -323,9 +323,9 @@ char * caml_dlerror(void) #define RTLD_NODELETE 0 #endif -void * caml_dlopen(char * libname, int for_execution) +void * caml_dlopen(char * libname, int for_execution, int global) { - return dlopen(libname, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); + return dlopen(libname, RTLD_NOW | (global ? RTLD_GLOBAL : 0) | RTLD_NODELETE); /* Could use RTLD_LAZY if for_execution == 0, but needs testing */ } @@ -361,7 +361,7 @@ char * caml_dlerror(void) #endif #else -void * caml_dlopen(char * libname, int for_execution) +void * caml_dlopen(char * libname, int for_execution, int global) { return NULL; } |