From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA07655; Thu, 8 Apr 2004 09:11:10 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA07256 for ; Thu, 8 Apr 2004 09:11:09 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i387C2jq018925; Thu, 8 Apr 2004 09:12:02 +0200 Received: from bourg.inria.fr (bourg.inria.fr [128.93.11.100]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA04020; Thu, 8 Apr 2004 09:11:08 +0200 (MET DST) Received: from starynke by bourg.inria.fr with local (Exim 4.31) id 1BBTgM-0004Tn-9h; Thu, 08 Apr 2004 09:10:38 +0200 Date: Thu, 8 Apr 2004 09:10:38 +0200 To: Issac Trotts , caml-list@inria.fr Subject: Re: [Caml-list] Dynamically evaluating OCaml code Message-ID: <20040408071038.GA17170@bourg.inria.fr> References: <20040407210524.GA13909@bourg.inria.fr> <20020104004356.GA1672@mev> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20020104004356.GA1672@mev> User-Agent: Mutt/1.5.5.1+cvs20040105i From: Basile Starynkevitch X-Miltered: at nez-perce by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 dynamically:01 basile:01 basile:01 issac:01 trotts:01 2004:99 choosen:01 runtime:01 custum:99 runtime:01 embedding:01 embedding:01 invoke:01 htmlman:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Keywords: X-UID: 126 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 http://caml.inria.fr/ocaml/htmlman/manual032.html 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. Regards. -- Basile STARYNKEVITCH -- basile dot starynkevitch at inria dot fr Project cristal.inria.fr - INRIA Rocquencourt http://cristal.inria.fr/~starynke --- all opinions are only mine ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners