'I suppose it is technically possible, though I am already in my pyjamas' patch

The patch itself

Sigh

3a as it is contains at least 3 serious bugs therefore you will need 3a fix to build LablGTK, Hevea and others. Unfortunately one of the bugs is nasty and therefore unloading of modules loaded with Natdynlink is disabled, until i find enough motivation to fix it. 3a fix should be applied AFTER 3a, it's NOT standalone patch.

What is it?

A patch, against OCaml 3.04, making it possible to: create, link against and dynamically load shared objects on i386 ELF platforms.

Changes

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

What's new compared to second patch

Installation

You are all set now.

Binutils

SCaml needs most recent release(2.12 at the time of the writing) of GNU Binutils for some operations. (Technically only ld that supports -z nocopyreloc is required)

Recent binutils REQUIRED to:

Recent binutils NOT REQUIRED to:

Using it

Simple example that uses shared LablTk (Recent binutils required)

You can use results of this patch indirectly: camlp4.opt pa_r.cms pa_extend.cms q_MLast.cms pr_o.cms revised.ml

Problems

Other platfomrs

In theory this should work on all platforms with sufficiently smart dynamic linker and ld that can omit copy relocs: GNU ld(i386-elf, ia64-elf) with '-z nocopyreloc', SUN's linker with -b. Windows port is a bit more complicated(or so i think).

Feedback

Send comments, suggestions, falme to malc@pulsesoft.com or av1474@comtv.ru

GNU Binutils 2.12

Ways to get recent GNU Binutils 2.12 or better:

Previous patches

Second First
  1. As a side effect by name symbol resolution makes OCaml immune to this very unlikely failure. God knows, though, what horrible BAD side effects this patch has.

Malcy
Last modified: Sun Jan 4 20:58:21 MSK 2004