[Cairo] another set of Python bindings

James Henstridge james at daa.com.au
Thu Sep 11 18:58:45 PDT 2003

On 12/09/03 01:30, Maarten Breddels wrote:

> I don't mind giving up my project if you feel you can give maintain it
>and think it does everything(or more) my binding does. I don't support
>fonts in my binding, and only tried it out on Windows. But linux/unix
>shouldn't be a problem thanks to SWIG. I hope I have some time this
>weekend(just started at university) to check out your binding.
>What is nice about SWIG is that making binding to other
>scripts/languages is quite simple, Java, C#, Perl, Ruby, Tcl should be
>possible.. I think :)
 From my experiences, SWIG is suboptimal for wrapping "object oriented 
C" APIs.  It leaves you with a direct procedural binding of the C 
functions, and then you need to build something on top to get a binding 
more appropriate to the language.  In addition, you would probably need 
_different_ SIWG .i files for each of those languages, since the .i file 
generally has language specific annotations.

I guess I am a bit biased though, since I had some bad experiences with 
SWIG when I was first working on PyGTK (it quickly became 
unmaintainable).  The problems may not be as bad for Cairo though, since 
its API is much smaller by several orders of magnitude.

It would be good to work towards a single binding though.  My main 
requirement for such a binding is that I can use it as a dependency for 
pygtk at some point in the future (when GTK depends on Cairo).  Being 
usable with from PyGTK programs right now would be nice too.


Email: james at daa.com.au
WWW:   http://www.daa.com.au/~james/

More information about the cairo mailing list