Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: Shared libraries from caml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: Shared libraries from caml

> Is there any way to produce a sunos and/or solaris shared library from a
> caml module? Preferably in Caml Special Light, but Objective Caml will also
> do.
> In fact, I'm interested in a more specific problem. Could I use csl or
> ocaml to produce input for the Tcl "load" command? Has anybody tried it
> yet?

Dynamic linking of Objective Caml modules inside an Objective Caml program
is not completely impossible, but requires a lot of work. There are
global tables in the runtime that collect infos on all the Caml modules
linked in the application. These tables are currently fixed-size and
built at link-time. In the presence of dynamic linking, these would
need to be made extensible and updated correctly after dynamic linking.

Dynamic linking of O'Caml modules inside an arbitrary program (e.g. tcl)
is even harder. The whole Objective Caml runtime needs to be embarked
somehow. Also, if you don't have no control over the program that does
the dynamic linking, it's very hard to perform the correct
initializations, both of the module and of the runtime system itself.

It would be much easier to link Tcl into an O'Caml program that has
already all O'Caml modules statically linked. The callback Tcl -> O'Caml
is not too hard to do, see CamlTk4 for an example.

- Xavier Leroy