Re: C structs and STk FFI (and Copyright problems ...)

From: David Tillman <dtillman_at_cannonexpress.com>
Date: Mon, 28 Dec 1998 10:08:03 -0600

>>>> Erick Gallesio <eg_at_unice.fr> wrote:

> I've no implemented structures, because alignment problem make all the
> stuff very complicated. For now, if you want to do such a call you
> have two possibilities in such a case:
> - use pointers in the C lib (just say that the object is a
> void *). The problem is that if you don't have the source of the
> library, you need to write a wrapper which transform a pointer to the
> structure. In this case, this is probably more efficient to make
> an ad-hoc interface and avoid the FFI extra cost.

  That is what I did. What is the extra cost involved with the FFI?

> - since here the structure is a simple one, if you have a
> function such as "int f(unit x)", you can declare it in scheme as it
> is was a "int f(int id, int serial)"; The problem is that it
> de-structure your object, which is probably not suitable and it depend
> of the way structures are ordered, which is very machine specific.

  Actually, this was for a GDBM interface that I had hoped to do
  entirely in the FFI (which I did after writing a few wrappers).

  My thanks to Thomas Buerger for sending me his version of a GDBM
  interface. It wasn't quite what I was looking for so I rolled my own.

  -Dave

--
David Tillman              |  Bill: "Where do you want to go today?"
dtillman_at_cannonexpress.com |  Linus: "Been there, done that, got the t-shirt."
These are my opinions and not those of Cannon Express, Inc.
Received on Mon Dec 28 1998 - 17:09:08 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST