diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2006-09-28 21:36:38 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2006-09-28 21:36:38 +0000 |
commit | b0041ea9631ec5938bd7931128be484bd1a00bd3 (patch) | |
tree | c6cef2329b36f75240f8e5d01e296e7e69d5ca98 /byterun/win32.c | |
parent | 665b2d65b1fa59f30811a40063b4bbbe0b9214e0 (diff) |
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
Diffstat (limited to 'byterun/win32.c')
-rw-r--r-- | byterun/win32.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/byterun/win32.c b/byterun/win32.c index 229a07d63..427093a1d 100644 --- a/byterun/win32.c +++ b/byterun/win32.c @@ -120,9 +120,15 @@ char * caml_search_dll_in_path(struct ext_table * path, char * name) return res; } -void * caml_dlopen(char * libname) +void * caml_dlopen(char * libname, int for_execution) { - return (void *) LoadLibrary(libname); + HMODULE m; + m = LoadLibraryEx(libname, NULL, + for_execution ? 0 : DONT_RESOLVE_DLL_REFERENCES); + /* LoadLibraryEx can fail under Win 95/98/ME in cases where LoadLibrary + would succeed. Just try again with LoadLibrary for good measure. */ + if (m == NULL) m = LoadLibrary(libname); + return (void *) m; } void caml_dlclose(void * handle) |