summaryrefslogtreecommitdiff
path: root/bytecomp/dll.ml
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2009-05-20 11:52:42 +0000
committerDamien Doligez <damien.doligez-inria.fr>2009-05-20 11:52:42 +0000
commited32f569e3b636e0f12efdbbd5bba9e05cc434ac (patch)
tree20b551901a72edf7733a6fe5287deab21ed9b83b /bytecomp/dll.ml
parent7795eafa896b0c5b3066d5efec7ec49d69d44e4d (diff)
downloadocaml-ed32f569e3b636e0f12efdbbd5bba9e05cc434ac.tar.gz
merge changes from ocaml3110 to ocaml3111rc0
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9270 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'bytecomp/dll.ml')
-rw-r--r--bytecomp/dll.ml9
1 files changed, 6 insertions, 3 deletions
diff --git a/bytecomp/dll.ml b/bytecomp/dll.ml
index 4463d5b98d..f5ba48d4f5 100644
--- a/bytecomp/dll.ml
+++ b/bytecomp/dll.ml
@@ -85,13 +85,16 @@ let close_all_dlls () =
Raise [Not_found] if not found. *)
let find_primitive prim_name =
- let rec find = function
+ let rec find seen = function
[] ->
raise Not_found
| dll :: rem ->
let addr = dll_sym dll prim_name in
- if addr == Obj.magic () then find rem else addr in
- find !opened_dlls
+ if addr == Obj.magic () then find (dll :: seen) rem else begin
+ if seen <> [] then opened_dlls := dll :: List.rev_append seen rem;
+ addr
+ end in
+ find [] !opened_dlls
(* If linking in core (dynlink or toplevel), synchronize the VM
table of primitive with the linker's table of primitive