From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 2C306BBAF for ; Thu, 9 Dec 2010 12:54:09 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqcAACZSAE3VBIoRkWdsb2JhbACVTIdtgQCFTQEBAQEHDQoHEQQlwBeFSgSKdA X-IronPort-AV: E=Sophos;i="4.59,319,1288566000"; d="scan'208";a="70203794" Received: from impaqm1.telefonica.net (HELO telefonica.net) ([213.4.138.17]) by mail3-smtp-sop.national.inria.fr with ESMTP; 09 Dec 2010 12:54:06 +0100 Received: from IMPmailhost2.adm.correo ([10.20.102.39]) by IMPaqm1.telefonica.net with bizsmtp id gvUM1f00H0r0BT601zu1Zu; Thu, 09 Dec 2010 12:54:01 +0100 Received: from NANA.localdomain ([83.54.185.63]) by IMPmailhost2.adm.correo with BIZ IMP id gzu01f00u1NVYxv1izu1X3; Thu, 09 Dec 2010 12:54:01 +0100 X-Brightmail-Tracker: AAAAAA== X-original-sender: ferferse@telefonica.net Received: from mfp by NANA.localdomain with local (Exim 4.69) (envelope-from ) id 1PQf4S-0002eY-FQ for caml-list@inria.fr; Thu, 09 Dec 2010 12:54:00 +0100 Date: Thu, 9 Dec 2010 12:54:00 +0100 From: Mauricio Fernandez To: caml-list@inria.fr Subject: Re: [Caml-list] Re: Pre-compiled ocaml binary for windows Message-ID: <20101209115400.GC6553@NANA.localdomain> Mail-Followup-To: caml-list@inria.fr References: <20101203200646.GA7445@malaquias.DHCP-GERAL> <6C7D3CF0-5C04-4E51-939F-5086244DA055@inria.fr> <4CFD2259.6060200@gmail.com> <4CFDEE7E.8030000@frisch.fr> <4CFDFEA5.3000900@frisch.fr> <4CFE031A.6060801@frisch.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4CFE031A.6060801@frisch.fr> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Spam: no; 0.00; pre-compiled:01 ocaml:01 0100,:01 frisch:01 ocaml:01 argv:01 dynlink:01 loadfile:01 argv:01 exn:01 eprintf:01 uncaught:01 printexc:01 exn:01 dependencies:01 On Tue, Dec 07, 2010 at 10:49:14AM +0100, Alain Frisch wrote: > On 12/07/2010 10:42 AM, Sylvain Le Gall wrote: >>> An option could be to ship a minimalistic main program, which simply >>> dynlinks .cmxs files given on its command line. >>> >> >> You mean like ld.ocaml: >> https://forge.ocamlcore.org/projects/ld-ocaml/ > > Or just something like: > > let () = > try > for i = 1 to Array.length Sys.argv - 1 do > Dynlink.loadfile Sys.argv.(i) > done > with exn -> > Format.eprintf "Uncaught exception: %s@." (Printexc.to_string exn) > > (untested, and you probably want to print the stack trace as well) This approach is not exactly convenient because the list of cmxs to be loaded can easily get very long... ld.ocaml does a little more than that: it first builds a catalog of available cmxs and then tries to satisfy the dependencies from the "root" cmxs, both in terms of imported interfaces and implementations. It thus allows multiple library versions to coexist, since it operates with signature digests instead of filenames. This is similar to (C) library sonames, but safer because signature digests are intrinsically so. There are other subtleties to building the dynamic loader: it has to contain the libs it's linked against in full and has to avoid duplicated module loading by tracking which modules are already available. ld.ocaml uses GNU BFD to extract the cmxs header, so it should only need minor tweaks (essentially in the build system) to work on Windows. -- Mauricio Fernandez - http://eigenclass.org