Re: guile-ffi

Gordon Matzigkeit (gord@trick.fig.org)
15 Aug 1998 09:39:42 -0600

Hi!

>>>>> Marius Vollmer writes:

MV> That's true. But I'd say that it's the usual tradeoff: quick
MV> development with an interpretive approach, and good performance
MV> with a compiler.

Yep, but my machine is already fast enough that performance isn't an
issue any more (since the main hit is in initialization), and it's two
years old.

MV> Furthermore, I'm not convinced that we can get reliable bindings
MV> to C code without the help of a C compiler.

Anything a C compiler can do, Scheme can do better. ;)

MV> Does libffi know everything it needs to know about the ABI of a
MV> platform.

The libffi sources imply that it does.

MV> Can we extract all necessary information from header
MV> files, without reimplementing much of the compiler frontend?

I believe so. However, as with all wrappers, we need some human
intervention:

char **

might be a vector of strings, or else a modifiable string pointer.

I've been thinking long and hard about this issue, not in the context
of Guile, but in the context of a function call interface that is
portable to all platforms (and which doubles as a database format).

My task is to wrap the entire GNU C library in Guile, and that is much
too hard to write and maintain static C bindings. Basically, for
every public /include/some/file.h, I want to create a
/share/guile/gnulib/some/file.scm module that provides Scheme
bindings.

This is a reasonable task, with a little work.

MV> You, I'd like to help where I can. My current focus is on the
MV> Guile to Gtk+ bindings, which is developing into a quite general
MV> glue generator. It is currently very much on the static side,
MV> but putting some libffi into it to make it more dynamic would be
MV> cool.

I want to take the same approach with GTK+, so I'll fetch your work
and see what I can contribute. Benchmarking between the two
approaches will reveal a lot, IMO.

MV> Tom Lord has interfaced Systas (which is an offspring of Guile, I
MV> think) to a C parser. That could be very helpfull for parsing
MV> header files.

Do you know where I could find this?

-- 
 Gordon Matzigkeit <gord@fig.org> //\ I'm a FIG (http://www.fig.org/)
    Lovers of freedom, unite!     \// I use GNU (http://www.gnu.org/)

Copyright (C) 1998 FIG.org; the creator offers you this gift and wants it to remain free. See http://www.fig.org/freedom.html for details. This work may be copied, modified and distributed under the GNU General Public License (GPL). See http://www.gnu.org/copyleft/gpl.html.