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
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: 1997-03-03 (08:04)
From: Robbert VanRenesse <rvr@c...>
Subject: Re: ML extension language

You may also wish to look at Camouflage 1.1 (from
and camlp4 (in

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!


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