caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Problems with Dynlink and -pack?
@ 2002-09-12  9:45 Alessandro Baretta
  0 siblings, 0 replies; only message in thread
From: Alessandro Baretta @ 2002-09-12  9:45 UTC (permalink / raw)
  To: Ocaml

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) ->
	  prerr_string
	    ("ERROR: " ^ Dynlink.error_message e ^ "\n")

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

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 
obvious?

Alex

-------------------
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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-09-12  9:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-12  9:45 [Caml-list] Problems with Dynlink and -pack? Alessandro Baretta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).