Second shared patch

The patch itself

What is it?

A patch, against OCaml 3.03 ALPHA, making it possible to create, link against and dynamically load shared libraries on i386 ELF targets.


The user will notice 4 new command line options for ocamlopt compiler, all four only meaningful at the linking stage: For the list of source changes look at ChangeLog

What's new compared to first patch

This patch is a bit more involved. Among most important changes is addition of Natdynlink library. Camlp4(now in OCaml main distribution) was changed to take advantage of this.


You are all set now.

Using it

Following when typed in your shell prompt, will result in creation of shared library Second command will link against this newly created library. (CVS version of binutils required).
# ocamlopt -shared -o shared.cmxa -linkall
# ocamlopt -o main -cclib -Wl,-rpath,.
Or you can play with Camlp4 using the result of this patch indirectly:
# camlp4.opt pa_r.cms pa_extend.cms q_MLast.cms pr_o.cms
Simple example featuring labltk is here



Your comments are welcome. If you have something to say please do not hesitate, i can be found at (there were/are DNS problems with above address, so if you have problems, try


Ways to get new ld (4 October 2001 and beyond):

First shared patch

Can be found here
Last modified: Thu Nov 1 06:03:24 MSK 2001 Last modified: Wed Oct 1 15:37:15 MSD 2003