English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Problems with Dynlink and -pack?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-09-12 (09:36)
From: Alessandro Baretta <alex@b...>
Subject: [Caml-list] Problems with Dynlink and -pack?
I have written a program that takes as a parameter the name 
of an object file, links it dynamically through Dynlink, and 
computes functions defined by the imported module. Now, I 
have observed this curious behavior, which _might_ be a bug. 
Yet, before filing a bug report I'd like some feedback so 
that I can be sure that it is not due to some mistake I made 
in using Dynlink.

This is what I do:
$ ocamlfind ocamlc -g -package afo  -passopt -pack -o 
*auto_ddt_csv.cmo* tab_csv_utils.cmo auto_ddt.cmo

auto_ddt_csv.cmo is the object file I dynamically link in a.out.

$ ./a.out -mod auto_ddt_csv.cmo
Fatal error: exception Invalid_argument("Array.get")

By using Epeire/Ocamldebug I have been able to discover that 
the exception is raised by a standard library module within 
the following call:
let _ = try  Dynlink.loadfile "null_data_origin.cmo"
	with Dynlink.Error(e) ->
	    ("ERROR: " ^ Dynlink.error_message e ^ "\n")

Of course, Dynlink previously is initialized and the 
appropriate interfaces are successfully added with 

Up to this point I was quite convinced that there must be 
some bug in my code. However, I made the following test. I 
recompiled a.out and statically linked tab_csv_utils.cmo. I 
then executed a.out specifying auto_ddt.cmo as a parameter. 
This time Dynlink succeeded in linking the specified module.

The only difference between the two runs seems to be that in 
the first case, the dynamically linked object file has been 
manufactured using the -pack option of ocamlc, while in the 
second run, the dynamically linked module was generated 
directly from a source file.

This looks like a bug to me, and I'm ready to file a bug 
report, but is it really? Or have I overlooked something 


To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners