Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Dynamic linking
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jonathan Roewen <jonathan.roewen@g...>
Subject: Re: [Caml-list] Dynamic linking
> No document that I know, but the code is clear enough.
> You may have a look at Env.read_pers_struct for .cmi and
> Compilenv.read_unit_info for .cmx.
> However I'm not sure it would help you very much in practice.
> There are at least two other problems before you can do dynamic linking
> of native code in ocaml:
> * the code generator is geared toward static code, which means that it
>  cannot be handled by the runtime linker on many architectures
>  (I only know of a patch for x86)
> * some glue code is generated at link time
> So this looks like a rather difficult task...

Well, we'd be building our very own custom runtime linker for starters.

The idea goes something like:

- a single [kernel mode] address space everything is run in.
- somehow, necessary kernel symbols are exported (basically, what can
be seen in interface files)
- a runtime linker in the ocaml kernel loads ocaml code, and resolves
symbols to kernel functions so can call into the kernel directly (no
syscalls or IPC)
- probably have some way of having a defined entry point for
executables in ocaml code that's also exported, so kernel+linker can
run the code without needing some C layer.

Of course, the only problem here is: is it possible to do? ;-) I have
no idea myself... =/

Jonathan