[plt-scheme] Questions about modules, compilation, namespaces, planet and ffi

From: Bruno Deferrari (utizoc at gmail.com)
Date: Thu May 5 00:02:24 EDT 2005

Hi, its me again (new problems with the ffi)

I'm almost finished with the EFL ffi (3500+ lines of ffi code :P ), but
I'm having some problems, one with mzscheme crashing on library load, and
other with callbacks.

* The first one: mzscheme crashes when loading this lib (it only happens with
  this lib, an only from mzscheme, on mred it loads it without crashing).
  I'm running plt-scheme 299.100.

; code
(require (lib "foreign.ss"))
(define libevas (ffi-lib "libevas"))
; and here, I get a segv

; gdb output
#0  0x49c157a5 in __pthread_unlock () from /lib/libpthread.so.0
#1  0x49c12d95 in pthread_mutex_unlock () from /lib/libpthread.so.0
#2  0x498dee99 in _dl_open () from /lib/libc.so.6
#3  0x4992be8b in dlopen_doit () from /lib/libdl.so.2
#4  0x497ccd46 in _dl_catch_error_internal () from /lib/ld-linux.so.2
#5  0x4992c286 in _dlerror_run () from /lib/libdl.so.2
#6  0x4992bed4 in dlopen@@GLIBC_2.1 () from /lib/libdl.so.2
#7  0x0811b785 in free_cl_cif_args ()
#8  0x0806f867 in scheme_do_eval ()
#9  0x0806f008 in scheme_do_eval ()
#10 0x0810668a in scheme_define_parse ()
#11 0x081047e3 in scheme_define_parse ()
#12 0x0806e56a in scheme_do_eval ()
#13 0x0806fafd in scheme_do_eval ()

* The second one: I have problems with callbacks, I cant get them to work.
  This code for example, I hava a callback thats going to be called when
  the window is rezised (resize-cb), but when that happens, the program
  stops with an error.

(define (resize-cb ee) ; the func called when the win is resized
  (display "a\n"))
(ecore-evas-callback-resize-set ee resize-cb) ; I set the callback
(ecore-main-loop-begin) ; I start the main loop

  Then when I resize the window resize-cb gets called, and after it prints "a"
  it stops giving the following error:

Scheme->C: expects argument of type <non-void-C-type>; given #<ctype>

  The definition of ecore-evas-callback-resize-set is:

; C definition :
; void ecore_evas_callback_resize_set(Ecore_Evas *ee,
;				      void (*func) (Ecore_Evas *ee));

(defecore-evas* ecore-evas-callback-resize-set :
  _EcoreEvas (_fun _EcoreEvas -> _void)
  -> _void)

  I don't know what I'm doing wrong, none of the callbacks work.

  Well, thats was all for today ;)

Posted on the users mailing list.