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
Dependencies and rebuilding
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-03-07 (21:48)
From: Jakob Lichtenberg <jakobl@w...>
Subject: RE: [Caml-list] Dependencies and rebuilding

First of all: Your statement is correct.  The following works great:

>type base.ml
let base () = 2+8;;

>ocamlopt -c base.ml

>ocamlopt -a base.cmx -o base.cmxa

>del base.cmx base.obj

>type consumer.ml
let _ = Printf.printf "Base.base: %d" (Base.base());;

>ocamlopt -c consumer.ml

>ocamlopt base.cmxa consumer.cmx -o app.exe

Base.base: 10

>notepad base.ml

>ocamlopt -c base.ml

>ocamlopt -a base.cmx -o base.cmxa

>del base.cmx base.obj

>ocamlopt base.cmxa consumer.cmx -o app.exe

Base.base: 11

Now, wrt. to cross-module inlining of code: Ohh, that's a very good
reason, I was not aware of this language feature.  Is there a higher
level of inlining going on if I leave the .cmx files next to the .cmxa
file? Maybe I should not use .cmxa files at all, for maximum inlining?
If .cmx files is present then what is the .cmxa file used for?


- Jakob

-----Original Message-----
From: oandrieu@gmail.com [mailto:oandrieu@gmail.com] On Behalf Of
Olivier Andrieu
Sent: Wednesday, March 07, 2007 1:25 PM
To: Jakob Lichtenberg
Cc: caml-list@inria.fr; Donn Terry
Subject: Re: [Caml-list] Dependencies and rebuilding

On 3/7/07, Jakob Lichtenberg <jakobl@windows.microsoft.com> wrote:
> If I change the body of functions in a base library, but not the
> externally visible signature, I still have to recompile the consumers
> the base library prior to linking the main application.  While this is
> not a problem in the trivial case I'll show beneath, it may be a
> from a componentization and scalability point of view.  Regular C code
> does not have this limitation.  This e-mail to request why the design
> as it is?

I'd say cross-module inlining of code ?

This happens because ocamlopt finds the base.cmx file during the
compilation of consumer. If you put your base module in a library and
remove the .cmx file, consumer won't depend on the implementation of
base, only on its interface.