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 JAA03674; Tue, 14 Aug 2001 09:52:02 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA03663 for ; Tue, 14 Aug 2001 09:52:02 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f7E7q0P24032; Tue, 14 Aug 2001 09:52:00 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA03630; Tue, 14 Aug 2001 09:51:59 +0200 (MET DST) Date: Tue, 14 Aug 2001 09:51:59 +0200 From: Xavier Leroy To: Jeff Henrikson Cc: caml-list@inria.fr Subject: Re: [Caml-list] Confusion about camlidl capabilities? other tools? Message-ID: <20010814095159.A2700@pauillac.inria.fr> References: <001701c1242d$e44770e0$0b01a8c0@mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <001701c1242d$e44770e0$0b01a8c0@mit.edu>; from jehenrik@yahoo.com on Mon, Aug 13, 2001 at 03:26:46PM -0400 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Reading the documentation of camlidl, it says that caml objects can > be exported for use in C/C++ programs. Looking at the source code, > the support for this looks minimal. I see the camlidldll script, > which is just a shell script that links a caml program with some > executable code. This is just a convenience script. The gist of CamlIDL is that it generates stub code + a Caml interface from a C-like interface expressed in IDL (basically, it's a C include file with annotations). This provides Caml/C (and a little C++) interoperability in situations where the C interface is fixed. But that's not what you want: > I want real C header files from just plain unannotated mli. > Preferably a system with ability to map variants into C > struct/unions coupled with utility functions. I'm not sure which > other advanced ocaml datatypes I need beyond variants and the basic > ints, strings, arrays and etc. What you need is Camouflage by Robbert van Renesse: ftp://ftp.cs.cornell.edu/pub/rvr/camou-1.1.tar.gz >>From the announcement: 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. > While I'm at it, I will probably try to export stubs at least these > styles: COM, GTK-style C objects, and SWIG-ready header files for > inclusion in Python or TCL or whatever some unenlightened person > would want to use. Sounds good. I don't think Camouflage does any of this, and it hasn't been updated in a while, but I think it could be a good starting point. - Xavier Leroy ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr