[plt-scheme] FFI problems

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Sep 25 21:54:16 EDT 2007

On Sep 25, Henk Boom wrote:
> [...]
> With this code I get the error:
> Seg fault (internal error) at 0x9d1b
> Aborted

It doesn't look like a foreign-related issue.  I tried this:

  (require (lib "foreign.ss"))
  (define gobject-lib (ffi-lib "libgobject-2.0"))
  (define gtk-lib (ffi-lib "libgtk"))
  (define gtk_init
    (get-ffi-obj "gtk_init" gtk-lib (_fun _pointer _pointer -> _void)))
  (gtk_init #f #f)

on two systems and it crashes, but it does not happen if I comment out
the gobject-lib line.

> P.S.: Also, is there a way to have the external object names in the
> above macros automatically generated from the name given for the
> procedure? I know it's simple with define-macro, but I'm not sure how
> to do it with define-syntax.

See the examples in the `ffi' collection.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.