[Larceny-users] Apparent bug in lib/Ffi/tramp.sch

David Rush kumoyuki at gmail.com
Sat Jan 23 11:41:16 EST 2010


This is pretty straightforward. I had a program that was invoking a
Scheme callback from inside another FFI call and would give this
error:

Error: i386 callback: bad selector arg-single
Entering debugger; type "?" for help.
debug> b
=> compiled procedure debug/enter-debugger
   compiled procedure ffi/make-callback
(c:\tools\larceny\larceny-0.97-bin-native-ia32-win32\/lib/Ffi/tramp.sch
: 133 : 1)
   compiled procedure ffi/make-callback
(c:\tools\larceny\larceny-0.97-bin-native-ia32-win32\/lib/Ffi/tramp.sch
: 133 : 1)
   compiled procedure #f
(c:\tools\larceny\larceny-0.97-bin-native-ia32-win32\/lib/Base/std-ffi.sch
: 339 : 15)
   compiled procedure #f
(c:\tools\larceny\larceny-0.97-bin-native-ia32-win32\/lib/Base/std-ffi.sch
: 502 : 5)
   compiled procedure #f
(c:\tools\larceny\larceny-0.97-bin-native-ia32-win32\/lib/Base/std-ffi.sch
: 502 : 5)
   compiled procedure #f
   ... etc


and after poking around a bit around a bit I found that this code in
tramp.sch was in fact the culprit:

(define (ffi/make-callback abi proc arg-descriptor ret-descriptor)
...
      (case (car args)
	((signed32 unsigned32 pointer)
	 ((abi 'arg-word) tr))
	((signed64 unsigned64)
	 ((abi 'arg-word2) tr))
	((ieee32)
	 ((abi 'arg-single) tr))
	((ieee64)
	 ((abi 'arg-double) tr))
	(else ???)))
...

changing the arg-single and arg-double to arg-ieee32 and ard-ieee64
respectively seems to make everything work ok. Well ok, enough for me
to move on to the next crash :)

david
-- 
GPG Public key at http://cyber-rush.org/drr/gpg-public-key.txt



More information about the Larceny-users mailing list