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
[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: -- (:)
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,
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: