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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jerome Vouillon <Jerome.Vouillon@i...>
Subject: Re: Dynamic link
On Fri, Apr 21, 2000 at 07:13:00PM +0200, Nicolas GEORGE wrote:
> I have written a small patch to the OCaml (2.99) run-time, that enables to
> dynamically load C primitives, instead to have to link against a custom
> run-time. It is far from perfect, but at this time, it works (under Unix
> systems).
[...]
> One main advantage is to can use OCaml for small applications (such as
> simple front-ends) that needs special libraries (GUI, Unix, Str...) without
> the 1/2 megabyte of the custom run-time.

Actually, if you are concerned about the size of a custom runtime, it
is much simpler to patch the OCaml makefiles so that the standard
library and the special libraries are built as shared library.

I think your patch would be much more interesting if it provided an
API for dynamically loading C libraries at execution time (rather than
at initialization time) and if the corresponding C primitives could
then be used by dynamically loaded Caml code.

[...]
> - there is a small memory waste (2kb) because the names of the builtins
>   primitives are twice im memory

I don't think you need to consider builtin primitives in a special
way: just consider the runtime as another shared library.

> Of course, there are some points to solve. The linker should build himself
> the list of needed primitives, but I was too afraid to touch the compiler.

You should definitively do that. And I think it's easy.

-- Jerome