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
[Caml-list] Writing a JIT compiler
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-06-26 (19:19)
From: Basile Starynkevitch [local] <basile.starynkevitch@i...>
Subject: Re: [Caml-list] Re: Writing a JIT compiler
On Sat, Jun 26, 2004 at 01:45:02PM +0000, Julian Brown wrote:
> On 2004-06-25, Basile Starynkevitch [local]
> <> wrote:
> > Also note that ocamljitrun is a binary which is a plugin replacement
> > for ocamlrun, this means that (as far as I understand your needs) you
> > don't need to link it with your program. This means that the
> > hypothetical linking issues of the LGPL is not a concern. In my
> > non-lawyer opinion, ocamljitrun is like ocamlrun so can run any
> > program you like, including commercial ones.

My feeling is that custom linking is nearly obsolete - better use dll
libraries which are well supported in ocaml now.

> Sorry for changing the subject, but can ocamljitrun be used with
> "ocamlc -custom"? I have a program which uses some small C modules,
> and I couldn't find an obvious way to make it compile or run using
> ocamljitrun. AFAIK, -custom links the bytecode interpreter with the
> binary as part of its magic.

It is doable by linking the libcamljitrun.a instead of
libcamlrun.a. Since -lcamlrun is a builtin library name (in ocamlc
-custom), the trick (suggested by Xavier Leroy) is to copy
libcamljitrun.a into a unique directory like
/usr/local/lib/ocamljitdir/ and pass -cclib
-L/usr/local/lib/ocamljitdir/ to your ocamlc command.

> On topic, does that affect licencing? It doesn't really matter to me,
> but it might for some people I guess...

Ocamljitrun is under LGPL as is GNU lightning. I believe that the
special exception applying to Ocaml like software like ocamljitrun do
not apply to the GNU lightning library, which is LGPL, but as I said
many times, I AM NOT A LAWYER.

the Ocamljit library should be buildable as a shared library - just
edit the GNUUmakefile of ocamljit appropriately to add -fPIC to the
compilation command, and build a shared library instead of a static
one. As usual on x86 there is a small penalty (because of register
shortage for global offset table access) in shared libraries.

Basile STARYNKEVITCH -- basile dot starynkevitch at inria dot fr
Project - temporarily --- all opinions are only mine 

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: