From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 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 9BC14BB84 for ; Tue, 23 Sep 2008 13:42:50 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtEDAOhy2EjAXQImiGdsb2JhbACTIAEBARUinF+HIIFm X-IronPort-AV: E=Sophos;i="4.32,452,1217800800"; d="scan'208";a="17256674" Received: from discorde.inria.fr ([192.93.2.38]) by mail3-smtp-sop.national.inria.fr with ESMTP; 23 Sep 2008 13:42:50 +0200 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m8NBgiXS003862 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 23 Sep 2008 13:42:50 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AosFAG5y2EhQDPIbXmdsb2JhbACTFhcJCgYSBZxWhyKBZg X-IronPort-AV: E=Sophos;i="4.32,452,1217800800"; d="scan'208";a="29492091" Received: from smtp20.orange.fr ([80.12.242.27]) by mail4-smtp-sop.national.inria.fr with ESMTP; 23 Sep 2008 13:42:49 +0200 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2009.orange.fr (SMTP Server) with ESMTP id 36B8B1C000A0; Tue, 23 Sep 2008 13:42:47 +0200 (CEST) Received: from [127.0.0.1] (APuteaux-154-1-14-138.w83-199.abo.wanadoo.fr [83.199.7.138]) by mwinf2009.orange.fr (SMTP Server) with ESMTP id 916AF1C00081; Tue, 23 Sep 2008 13:42:46 +0200 (CEST) X-ME-UUID: 20080923114246595.916AF1C00081@mwinf2009.orange.fr Message-ID: <48D8D635.3040705@frisch.fr> Date: Tue, 23 Sep 2008 13:42:45 +0200 From: Alain Frisch User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Richard Jones Cc: bill yan , =?ISO-8859-1?Q?St=E9phane_Glondu?= , caml-list@inria.fr Subject: Re: [Caml-list] What's the purpose of the static library? References: <48D712A8.6090506@sun.com> <48D766CC.5020401@glondu.net> <48D8B266.4000906@sun.com> <20080923101710.GA29133@annexia.org> In-Reply-To: <20080923101710.GA29133@annexia.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 080922-0, 22/09/2008), Outbound message X-Antivirus-Status: Clean X-Miltered: at discorde with ID 48D8D634.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; frisch:01 frisch:01 cmo:01 'ocamlc:01 cmo:01 cmx:01 cmx:01 ml':01 compiler:01 cmxa:01 inlining:01 -for-pack:01 compiler:01 dependencies:01 compilation:01 Richard Jones wrote: > File: library.cma ------------------------------ > > This is just a set of *.cmo files combined together. > > Created by: 'ocamlc -a' > > Used: Same as for module.cmo .cma files also contain extra linking directives like references to C libraries. > Files: module.o and module.cmx -------------------- > > These two files go together. The *.o file contains compiled native > code in the normal system object file format. The *.cmx file contains > metainformation about the machine code in the *.o file. > > Created by: 'ocamlopt -c module.ml' > > Used: When linking native code programs, or creating native code > libraries. ... or compiling other modules. > > Note(1): You normally never need to specify the *.o files by hand. On > the command line when the compiler sees a *.cmx file, it looks for the > corresponding *.o file if it needs it. > > Note(2): It is thought that the *.cmx file needs to be around even > when linking a library (*.cmxa) file in order to do cross-module > function inlining. Both the Debian & Fedora packaging rules specify > that *.cmx files be kept around for this reason. Whether this is > really true or not is not certain. This is true. .cmx files are needed when they contain modules compiled with -for-pack. Otherwise, they are optional. Hiding them to the compiler is a way to get fewer dependencies (more separate compilation). Note that the .o extension is actually .obj for the MSVC ports under Windows. > File: library.a and library.cmxa -------------------- > > These files go together. The *.a file contains compiled native code > in the normal system archive format. The *.cmxa file contains > metainformation. > > Created by: 'ocamlopt -a' > > Used: Same as for *.o/*.cmx > > Note: You normally never need to specify the *.a files by hand. (.lib for MSVC ports) > File: dlllibrary.so and liblibrary.a -------------------- > > These files are created and used when a bytecode or native library > contains some C code. 'dllXXX.so' is created for use by the toplevel > and contains the compiled C code. 'libXXX.a' is created for use by > compiled standalone programs and also contains the same compiled C > code. > > Created by: 'ocamlmklib -o library *.o *.cmo' > or: 'ocamlmklib -o library *.o *.cmx' > > Used: dlllibrary.so is dlopen(2)'d by the toplevel. > liblibrary.a is linked in standalone programs. dlllibrary.so is also used by the bytecode interpreter, by Dynlink and by ocamlc (to check for the availability of C primitives at compile time). -- Alain