[mercury-users] Working with exported types

Peter Moulder Peter.Moulder at infotech.monash.edu.au
Fri Jul 28 16:48:10 AEST 2006


On Thu, Jul 27, 2006 at 10:15:46PM +1000, Jonathan Morgan wrote:

> Many libraries use #define's rather than enums - which SWIG cannot
> really know about very well.

http://www.swig.org/compare.html claims that swig does handle #defines;
though presumably each #define would be mapped to an independent
function returning a generic type like int.  I don't think this is too
much of a problem: the developer's reasons for #defining to an int (e.g.
use in arithmetic) may well apply to Mercury code too.

> However, while SWIG is fairly good for C, it needs a lot of guidance
> when binding quite a few C++ constructs (this may or may not be a
> problem).

The same page claims that "SWIG provides wrapping support for almost all
of ANSI C++", followed by a table of things supported, and a couple of
paragraphs on things not supported, of which it describes nested classes
as the most important thing not yet supported.

The only thing it lists as needing guidance is that templates must be
explicitly instantiated.  There is a larger list of "Customization
features" that Jonathan may be counting as "needing guidance".

> I'm currently experimenting with using XML files used to generate
> Gtk#, the C# binding to Gtk, but they don't always have all the
> information that Mercury needs

It would be nice to extend the XML DTD: information needed by Mercury
may well be useful to similar languages.

I've just looked up how people do a gtk binding for Haskell: the Gtk2Hs
developers use the `C->Haskell' interface generator
(http://www.cse.unsw.edu.au/~chak/haskell/c2hs/),
and copy/adjust C gtk's documentation by hand.

pjrm.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list