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.

Changes

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.

Installation

You are all set now.

Using it

Following when typed in your shell prompt, will result in creation of shared library labltk.so. Second command will link tkiface.ml against this newly created library. (CVS version of binutils required).
# ocamlopt -shared -o shared.so shared.cmxa -linkall
# ocamlopt -o main shared.so.cmxa main.ml -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 revised.ml
    
Simple example featuring labltk is here

Problems

Feedback

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

Binutils

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

First shared patch

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