caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Basile Starynkevitch local <basile.starynkevitch@inria.fr>
To: skaller <skaller@users.sourceforge.net>, caml-list@inria.fr
Subject: Re: [Caml-list] Automatic wrapper generator
Date: Tue, 18 May 2004 11:06:35 +0200	[thread overview]
Message-ID: <20040518090635.GA6918@bourg.inria.fr> (raw)
In-Reply-To: <1084869517.19838.409.camel@pelican.wigram>

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 <stdio.h> 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


  parent reply	other threads:[~2004-05-18  9:07 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-18  8:38 skaller
2004-05-18  8:58 ` Richard Jones
2004-05-18 10:07   ` skaller
2004-05-18  9:06 ` Basile Starynkevitch local [this message]
2004-05-18 10:25   ` skaller
2004-05-18 12:11     ` Richard Jones
2004-05-18 17:21       ` Michael Hamburg
2004-05-18 18:34         ` skaller
2004-05-18 19:27           ` Richard Jones
2004-05-18 20:52             ` skaller
2004-05-18 20:02       ` Gerd Stolpmann
2004-05-18 20:10         ` [Caml-list] Functional critical section SWAMPY
2004-05-18 20:31           ` Kenneth Knowles
2004-05-18 20:39           ` Evan Martin
2004-05-19  7:35             ` thornber
2004-05-19  7:33           ` thornber
2004-05-18  9:25 ` [Caml-list] Automatic wrapper generator Olivier Andrieu
2004-05-18 10:36   ` skaller
2004-05-18  9:38 ` Fermin Reig
2004-05-18 10:42   ` skaller
2004-05-18 10:57     ` Felix Winkelmann
2004-05-18 10:58     ` John Chu
2004-05-18 11:33       ` skaller
2004-05-22 10:09 ` Marcin 'Qrczak' Kowalczyk
2004-05-22 13:13   ` skaller
2004-05-22 14:19     ` Marcin 'Qrczak' Kowalczyk
2004-05-22 16:14       ` skaller
2004-05-23 10:58         ` Marcin 'Qrczak' Kowalczyk
2004-05-23 19:59           ` skaller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040518090635.GA6918@bourg.inria.fr \
    --to=basile.starynkevitch@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=skaller@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).