[plt-scheme] state of mzscheme and gtk2

From: Dmitriy.Zavin at infineon.com (Dmitriy.Zavin at infineon.com)
Date: Thu Feb 10 20:06:24 EST 2005

 >The main thing I like about using SWIG, is:
 >
 >1. It does a great job, parsing C header files. 
 >2. It is fantastic to implement automagic type coercion between
 >   Scheme and C. And thereby gives the oppertunity to make GTK
 >   function accessible as if it were completely in the Scheme Domain.
 >   One does not necessarily have to notice that one is programming
 >   with C functions.
 >3. In generates all the necessary C wrapper code to interface 
 >   with scheme.
 >4. Given de proper definition files, it could be so that only the
 >   typemaps between mzscheme and C need to be changed to make
 >   things usable for e.g. chicken or bigloo.
 >
 >I'm not sure about what the common foreign function interface 
 >looks like, but this is what I like about SWIG. Maybe a language
 >module in SWIG for mzscheme that implements FFI wrapper code 
 >is interesting?

That's basically the reason to use SWIG :) The amount of work it takes
to get the wrapper created is pretty low once you did it the first time.
We have several devices for which I use SWIG to create a scheme
interface, and most things are just copy and paste. I had to write maybe
10-20 typemaps and the entire device API was wrapped. It's definitely
not as nice as I like it to be for structures since they are copied
instead of referenced. This is where the FFI could come in handy in the
future. I'll give it a whirl when I have time, but I rather wait till
299 is released and finalized ;)

--Dima



Posted on the users mailing list.