From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA11777; Thu, 12 Sep 2002 11:36:29 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA11739 for ; Thu, 12 Sep 2002 11:36:28 +0200 (MET DST) Received: from athlon.baretta.com (host209-68.pool80116.interbusiness.it [80.116.68.209]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g8C9aR106244 for ; Thu, 12 Sep 2002 11:36:27 +0200 (MET DST) Received: from baretta.com (localhost.localdomain [127.0.0.1]) by athlon.baretta.com (Postfix) with ESMTP id C5077273B9 for ; Thu, 12 Sep 2002 11:45:22 +0200 (CEST) Message-ID: <3D806232.9010204@baretta.com> Date: Thu, 12 Sep 2002 11:45:22 +0200 From: Alessandro Baretta Organization: Baretta srl -- www.baretta.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: it, en MIME-Version: 1.0 To: Ocaml Subject: [Caml-list] Problems with Dynlink and -pack? Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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