[plt-scheme] FFI: callbacks returning `void' don't work

From: K.S.Sreeram (sreeram at tachyontech.net)
Date: Tue Jul 31 02:16:20 EDT 2007


I have the following callback function type defined.

(define _window-callback (_fun _window _int _pointer -> _void))

And I'm using the following Scheme procedure as the callback:

(define (event-handler window event data)
  (display event) (newline))

I'm getting the following error:
"Scheme->C: expects argument of type <non-void-C-type>; given #<ctype>"

This appears to be a bug where 'void' returning callback procedures are
not supported. (Simply changing the return type from _void to _int, and
returning a dummy integer value from the Scheme procedure works)


Posted on the users mailing list.