Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Executable size?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-11-15 (15:13)
From: John J Lee <jjl@p...>
Subject: Re: [Caml-list] Executable size?
On Sat, 16 Nov 2003, skaller wrote:
> On Fri, 2003-11-14 at 06:58, John J Lee wrote:
> > OK.  Getting back to the original question again (how to reduce data to be
> > transferred over the network), both O'Caml and C statically link this
> > runtime stuff, right?  So, why is O'Caml's "hello world" (compressed) 45k,
> > to C's 1 or 2k?  Is that 43k the garbage collector?  Or is it mostly that
> > O'Caml, in contrast to C, is linking in a bunch of stuff from its standard
> > library that isn't strictly required for "hello world"?  Or something else
> > again??
> >
> > Hope I'm not going round in circles here...
> The Ocaml equivalent of a C stub program which dynamically
> links to the C run time is bytecode.

And, you're implying, even C's "hello world" *is* using the C standard
library, because of printf -- and O'Caml is using it's standard library
for the same reason.  So part of the O'Caml standard library is statically
linked into hello world, thus explaining part of the 43k difference?  In
that case, I wonder what the C / O'Caml executable size discrepancy for
"hello world" becomes if you use only OS routines directly?

> Ocaml native code compiler, at least on the x86,
> does not generate relocatable code, and so Ocaml
> library functions cannot be dynamically linked.
> [At present .. :]

So, an O'Caml .DLL or .so is implemented using O'Caml bytecode?

> In my opinion, you best bet is to generate bytecode
> and distribute that. Your clients WILL have to download
> the bigger ocamlrun driver harness, but hopefully
> only once.

That's not useful in the case where the user is only downloading one
program, unfortunately.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: