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-13 (01:24)
From: Nicolas Cannasse <warplayer@f...>
Subject: Re: [Caml-list] Executable size?
> How does O'Caml compare with languages like Haskell (ghc), C and C++ for
> executable size?  Does compiled code depend on a runtime library (and how
> big is that, if so)?
> Are there any easily-identifiable, non-obvious, factors that affect
> executable size (I'm talking about end-use factors, rather those resulting
> from the design decisions taken by the language designers and
> implementors)?
> I currently use Python by preference, but I'm interested in a language
> (other than C/C++!) that doesn't depend on a big runtime library and
> generates "reasonably" small executables -- modems are here to stay for a
> while yet.

If you need COM support , look at OCaml'OLE :
If you need to make Windows DLL , look at ODLL :
If you need access to the win32 API, look at the ocaml port here :

About the size of the executables (in native mode) :
The main problem for a Window developper is that usually when you link a
library staticly, the inclusion is made on a function basis, and not on a
module basis as ocaml do. Then if you have big Ocaml libraries, you should
split them into several indepent modules if feasible to avoid linking all.

I also found recently (is it a 3.07 "feature" - i didn't compare with 3.06
?) that classes compiled natively are taking an huge amount of space : a
~2000 lines library defining ~25 classes with actually not so much code is
compiling into a 100 Ko library in bytecode and into 440 Ko in native...
Using dynamic linking of C stubs will help here , but there is actually no
way of dynlinking Ocaml librairies ( the Dynlink module is not actually
doing any linking.... only loading ).

>From my own experience, executables size are growing faster in OCaml than in
C/C++, with a big leap every time you're linking with an additional
library.... but their size worth it !

Nicolas Cannasse

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