From b0041ea9631ec5938bd7931128be484bd1a00bd3 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Thu, 28 Sep 2006 21:36:38 +0000 Subject: Revised DLL loading: distinguish between loading for execution (ocamlrun, dynlink, toplevel) and loading for checking the existence of symbols (ocamlc). This is needed for Windows with manifests and not a bad idea for other platforms. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7656 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- byterun/unix.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'byterun/unix.c') diff --git a/byterun/unix.c b/byterun/unix.c index 7bb986008..def4f152c 100644 --- a/byterun/unix.c +++ b/byterun/unix.c @@ -199,7 +199,7 @@ entry_t *caml_lookup_bundle(const char *name) return current; } -void * caml_dlopen(char * libname) +void * caml_dlopen(char * libname, int for_execution) { NSObjectFileImage image; entry_t *bentry = caml_lookup_bundle(libname); @@ -283,9 +283,12 @@ char * caml_dlerror(void) #define RTLD_NODELETE 0 #endif -void * caml_dlopen(char * libname) +void * caml_dlopen(char * libname, int for_execution) { - return dlopen(libname, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); + return dlopen(libname, + for_execution + ? RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE + : RTLD_LAZY); } void caml_dlclose(void * handle) -- cgit v1.2.3-70-g09d2