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] [ANN] The Missing Library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-24 (01:38)
From: John Carr <jfc@m...>
Subject: [Caml-list] ocamlopt -pack portability

> Also the ocamlopt version [of -pack] doesn't seem to be very portable,
> which is a point against it.

ocamlopt -pack needs GNU binutils.  That is no problem for Linux
users but a significant barrier for many others.

The names of symbols in OCaml object files begin with the name of the
module they belong to.  Unlike Java compilers, ocamlopt does not know
the name of the container module at compile time.  When modules are
packed ocamlopt calls objcopy --redefine-sym to change the names of
symbols to match the new fully qualified module name.  For example, if
you pack a module named Hashtbl into a module named Stdlib, the symbol
Hashtbl must be renamed to Stdlib__Hashtbl.

I usually run Solaris, which does not come with binutils.  I consider
binutils to be too large a package to justify installing for such a
minor feature so I wrote a C program to do the symbol renaming.  (Send
me email if you want it.  It uses libelf and I have only tested it on
Solaris.  You also need a minor change to Asmpackager.extract_symbols
to work with Solaris nm.)

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