caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jakob Lichtenberg <jakobl@windows.microsoft.com>
To: Olivier Andrieu <oandrieu@nerim.net>
Cc: <caml-list@inria.fr>, Donn Terry <donnte@windows.microsoft.com>
Subject: RE: [Caml-list] Dependencies and rebuilding
Date: Wed, 7 Mar 2007 13:47:20 -0800	[thread overview]
Message-ID: <43CD2D195487A448934920501C6EDB2303E34383@WIN-MSG-21.wingroup.windeploy.ntdev.microsoft.com> (raw)
In-Reply-To: <95513600703071324j3602604bw4d87a5dee3797c7f@mail.gmail.com>

Olivier,

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

>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

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

Thanks,

- 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
of
> 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
concern
> from a componentization and scalability point of view.  Regular C code
> does not have this limitation.  This e-mail to request why the design
is
> 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.

-- 
  Olivier


  reply	other threads:[~2007-03-07 21:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-07 20:07 Jakob Lichtenberg
2007-03-07 21:24 ` [Caml-list] " Olivier Andrieu
2007-03-07 21:47   ` Jakob Lichtenberg [this message]
2007-03-07 21:25 ` Zheng Li
2007-03-08  7:05 ` [Caml-list] " Alain Frisch
2007-03-08 16:55   ` malc
2007-03-09  8:01     ` Alain Frisch
2007-03-09  8:06       ` malc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43CD2D195487A448934920501C6EDB2303E34383@WIN-MSG-21.wingroup.windeploy.ntdev.microsoft.com \
    --to=jakobl@windows.microsoft.com \
    --cc=caml-list@inria.fr \
    --cc=donnte@windows.microsoft.com \
    --cc=oandrieu@nerim.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).