Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: ML extension language
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Robbert VanRenesse <rvr@c...>
Subject: Re: ML extension language

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
>
>
>
>