English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Automatic wrapper generator
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-05-18 (20:52)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Automatic wrapper generator
On Wed, 2004-05-19 at 05:27, Richard Jones wrote:
> I think your analysis is correct, except that you've missed out C
> macros.  Both the Perl and Gtk C interfaces use macros all over the
> place as a kind of inline function.

Flxcc currently forgets all about macros.

I'm not totally unhappy :)

You may have to call __f instead of f.
That's not quite as bad as losing M_PI out of math.h though.

To fix this I'd need a C preprocessor to modify,
and probably also some annotations to help chose
the macros to export as part of the interface.

They'd have to be typed.. which isn't so easy if the macros
are used as generics.

Felix itself has no problem with binding macros,
including generic ones (just cheat a bit and pretend
they're really parametrically polymorphic).

Note I haven't forgotten them. Indeed one of my main
reasons for abandoning SWIG was that it doesn't
provide any hooks to catch macros intended as
functions. (It catches constants automatically though).

The bottom line is that if you want to make a wrapper
that conforms to a well specified (documented) interface,
you should do it 'by hand' or by processing the documentation,
not by processing the source code. Of course probably
the fastest way to do this is to patch up a flxcc generated
wrapper.. :)

John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net

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