From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA28824 for caml-redistribution; Mon, 3 Mar 1997 09:04:48 +0100 (MET) 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 TAA19787 for ; Fri, 28 Feb 1997 19:29:02 +0100 (MET) Received: from simon.cs.cornell.edu (SIMON.CS.CORNELL.EDU [128.84.154.10]) by nez-perce.inria.fr (8.7.6/8.7.3) with ESMTP id TAA17807; Fri, 28 Feb 1997 19:28:58 +0100 (MET) Received: from cloyd.cs.cornell.edu (CLOYD.CS.CORNELL.EDU [128.84.227.15]) by simon.cs.cornell.edu (8.8.5/8.8.5/R-1.7) with ESMTP id NAA28134; Fri, 28 Feb 1997 13:28:56 -0500 (EST) Received: from tumeric (TUMERIC.CS.CORNELL.EDU [128.84.211.134]) by cloyd.cs.cornell.edu (8.8.5/8.8.5/M-1.8) with SMTP id NAA17217; Fri, 28 Feb 1997 13:28:55 -0500 (EST) Message-Id: <2.2.32.19970228182858.00af6658@popsrv.cs.cornell.edu> X-Sender: rvr@popsrv.cs.cornell.edu X-Mailer: Windows Eudora Pro Version 2.2 (32) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Fri, 28 Feb 1997 13:28:58 -0500 To: Xavier Leroy , laheadle@midway.uchicago.edu (Lyn A Headley) From: Robbert VanRenesse Subject: Re: ML extension language Cc: caml-list@inria.fr Sender: weis You may also wish to look at Camouflage 1.1 (from ftp://www.cs.cornell.edu/pub/rvr/camou-1.1.tar.gz) and camlp4 (in ftp://ftp.inria.fr/lang/chamau/). Camouflage 1.1 is a tool that supports interfacing between C and OCaml. Camouflage reads a .mli file and creates the necessary C interfaces to the given module. This way the fact that a library is written in OCaml can be ``camouflaged.'' Camouflage also supports creating OCaml interfaces to C functions, and generates functions that convert between OCaml and C data structures. For example, let say "x.mli" contains the declaration "val add: int -> int -> int". Then the command "camou x.mli" creates a file "x.c" that contains the C function "int X_add(int, int)" which does all the stuff necessary to invoke the ML function. Vice versa, the declaration "external add: int -> int -> int" creates an ML function to invoke a corresponding C function called add of that same signature. Hopefully Xavier's stuff will make all this obsolete so I don't have to support this any more! Robbert At 03:03 PM 2/28/97 +0100, Xavier Leroy wrote: >> I realize that CAML already contains facilities for creating new >> primitives in C, but the main difference is that in a caml program, >> the main program is the interpreter for the caml virtual machine, whereas >> in an extension language control resides in the application. > >Actually, it is possible to have the main program written in C and >calling Caml functions when needed. Release 1.03 contains very >preliminary support for this; the forthcoming release 1.04 provides >better support and documentation for this feature. > >- Xavier Leroy > > > >