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] How to create byte-code with static link
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-11-06 (09:03)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] How to create byte-code with static link
From: IKEDA Katsumi <>

> I make libfoo.a from foo.c.
> Now I can create bar the following
> ocamlc -o bar -dllpath /usr/local/foo/lib -I /usr/local/foo/lib foo.cma bar.cmo
> There are and libfoo.a in /usr/local/foo/lib
> In this case, is linked as dynamic link.

Not really linked: its name is just added to a table in your ocaml
bytecode. The system linker is not called.

> Is it possible link bar and libfoo.a as static link?

Yes, you just have to add the -custom flag.

  ocamlc -custom -o bar -I /usr/local/foo/lib foo.cma bar.cmo

By the way, ocamlopt always links in custom mode.
Note also that -custom is not equivalent to -ccopt -static: this one
is passed to the system linker, and is about whether to choose or libxxx.a during a custom link (it does not affect
non-custom linkage).

Jacques Garrigue      Kyoto University     garrigue at
		<A HREF=>JG</A>
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: