English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
ocaml, llvm and generating code at runtime
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-01-01 (18:17)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] ocaml, llvm and generating code at runtime
On Friday 01 January 2010 16:45:34 Joel Reymont wrote:
> Does anybody have example code that shows how to generate OCaml bindings at
> runtime with LLVM?

The OCaml Journal article "Calling C code from OCaml" (10th July 2008) 
described an OCaml program that invoked a C function both via a stub written 
in C and via JIT compiled interface code using LLVM (no more stinking C 

I would like to write more on JIT-compiled interface code in the future and 
perhaps write a library to make it easy.

> My goal is to compile an AST into code that uses OCaml functions within the
> same binary that's doing the compiling.
> I don't think it can be done with OCaml since it requires a standalone
> assembler, linker, etc. Correct me if I'm wrong, though. Mine is a
> web-based compiler with potentially many concurrent sessions. Running gas,
> ld, etc. seems a much heavier and less scalable approach that generating
> code at runtime.

Sounds like you really want HLVM. :-)

> 	Thanks and Happy New Year, Joel

Happy New Year!

Dr Jon Harrop, Flying Frog Consultancy Ltd.