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 LAA15734; Tue, 18 May 2004 11:07:08 +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 LAA15725 for ; Tue, 18 May 2004 11:07:07 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i4I976SH016063; Tue, 18 May 2004 11:07:06 +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 LAA15704; Tue, 18 May 2004 11:07:05 +0200 (MET DST) Received: from basile by bourg.inria.fr with local (Exim 4.32) id 1BQ0YV-0001of-QC; Tue, 18 May 2004 11:06:35 +0200 Date: Tue, 18 May 2004 11:06:35 +0200 To: skaller , caml-list@inria.fr Subject: Re: [Caml-list] Automatic wrapper generator Message-ID: <20040518090635.GA6918@bourg.inria.fr> References: <1084869517.19838.409.camel@pelican.wigram> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1084869517.19838.409.camel@pelican.wigram> User-Agent: Mutt/1.5.6i From: Basile Starynkevitch local X-Miltered: at concorde with ID 40A9D23A.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 basile:01 basile:01 2004:99 hackery:01 usr:01 include':01 stdio:01 stdio:01 printf:01 invokes:01 compiles:01 frontc:01 wrappers:01 usr:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, May 18, 2004 at 06:38:37PM +1000, skaller wrote: > This is a brief status report concerning the Felix > automatic wrapper generator (reason for posting to Caml list > explained below). > > With some platform specific hackery, I am now able to > wrap 90% of all headers in '/usr/include' and execute > a single Felix test case: > > ----------------------- > include "stdio_h"; > C_hack::ignore(stdio_h::printf(c"%s\n", c"Hello World")); > -------------------- > > Line 1 includes the wrapper generated for stdio.h. > Line 2 invokes the wrapper for a popular function 'printf()'. > This program compiles and executes correctly. [....] > > It isn't clear I have got everything right yet, > there is still a long way to go. However I do consider > this a reasonable "proof-of-principle" demonstration > that automatic wrapping of the complete C development > environment is possible. The wrapper generator uses the > frontc/Cil parser, and generates the wrappers for > of /usr/include in a couple of seconds. > > RELEVANCE TO OCAML. > ------------------ > > There isn't much that I'm doing for Felix wrappers > that can't be applied to Ocaml: perhaps with some > extra work it seems possible to make an Ocaml back end > to generate Foreign Function Interfaces for the whole > C environment in a few seconds. [...] very good, but I suggest a more difficult test: GTK2 (or at least the contained Glib2 library). Are you able to parse GTK2 or Glib2 or unistd.h or Xlib.h with your machinery, and to generate sensible glue code for these? I tend to believe that while has some intricacies (in particular, the variadic printf & scanf routines) there are other header files which are more complex to parse automatically. How do you handle C pointers, and more importantly, how do you separate the C pointers which carry a result - for instance like in scanf("%d",&i) and those which point to a composite input argument - for instance the fd_set pointer arguments to select? I tend to believe that both cases should be interfaced very differently in Ocaml Anyway, bravo for the good work Regards. -- Basile STARYNKEVITCH -- basile dot starynkevitch at inria dot fr Project cristal.inria.fr - phone +33 1 3963 5197 - mobile 6 8501 2359 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