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
Dynamic linking
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alain Frisch <Alain.Frisch@i...>
Subject: Re: [Caml-list] Dynamic linking
Brian Hurt wrote:
> B) How extensive were the changes to the Ocaml source code?

For Linux x86, the change is rather small and straightforward.

For Windows ports, it is more tricky, because a Windows DLL cannot
reference symbols from the main program. I wrote the FlexDLL tool to
simulate a POSIX-ish dlopen API, so that the patch to OCaml itself
mostly reduces to removing code or sharing Makefiles with Unix. All the
trouble is encapsulated into FlexDLL (which is itself a quite small
piece of code, but a tricky one).

>From Linux AMD64, the ABI/dynamic linker does not allow to dynamically
load position dependant code, so I had to modify the last stage of
ocamlopt's backend in order to produce PIC code (when the option -dlcode
is given; note that this is independant from the existing -fpic option,
details on demand). Again, this is a rather small and unintrusive change.

You can use CVS to get a diff between the ocaml3100 tag and the
natdynlink branch (but it won't show you new files; you can always "cvs
checkout" both and do a local diff).

> How likely
> is it that this will get included in some future version of the main trunk?

It is likely to be included in OCaml 3.11, not before. (Except for the
native toplevel which will probably not be included.) Of course,
feedback can only help for the integration.

-- Alain