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] Dynamically evaluating OCaml code
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-08 (07:11)
From: Basile Starynkevitch <basile.starynkevitch@i...>
Subject: Re: [Caml-list] Dynamically evaluating OCaml code
On Thu, Jan 03, 2002 at 04:43:56PM -0800, Issac Trotts wrote:
> On Wed, Apr 07, 2004 at 11:05:24PM +0200, Basile Starynkevitch wrote:

> > However, for the beginner, the good answer (at least as given by Ocaml
> > gurus here) to the usual "I want eval" request is simply "no you don't
> > really need it"
> That being so, how would you use OCaml as an extension language for a C
> program?  

I'm not sure to understand your point. Many applications coded in C
embed Ocaml inside. The simplest way is to give the application a
compiled ocaml bytecode file (which can be choosen at runtime) invoked
thru ocaml_main

See section 18.7.4 Main program in C of

An alternative is to have the application being a custum ocaml
program, with lots of C primitives. This means that the ocaml runtime
system has the control and invoke appropriately the C primitives
provided by the application.

If you ask about embedding the ocaml toplevel into your application,
it is a different question. I agree that extending or embedding or
customizing the toplevel is not very well documented.


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

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