Discussion:
[Larceny-users] FFI error when mixing SRFI 27 and (glut)
Eduardo Cavazos
2009-12-26 09:26:32 UTC
Permalink
Hello,

This program works fine:

----------------------------------------------------------------------
(import (rnrs)
(glut)
(srfi :27 random-bits))

(glutInit (vector 0) (vector ""))
----------------------------------------------------------------------

However, this one:

----------------------------------------------------------------------
(import (rnrs)
(srfi :27 random-bits)
(glut))

(glutInit (vector 0) (vector ""))
----------------------------------------------------------------------

results in an FFI error:

----------------------------------------------------------------------
~ $ rlwrap ~/src/larceny-0.97-bin-native-ia32-linux86/larceny -r6rs
-program /tmp/test-larceny-gl-b.sps
Warning: loading source in favor of stale fasl
file: /home/dharmatech/src/larceny-0.97-bin-native-ia32-linux86/lib/Standard/time.sch
Warning: loading source in favor of stale fasl
file: /home/dharmatech/src/larceny-0.97-bin-native-ia32-linux86/lib/Ffi/ffi-i386.sch
Warning: loading source in favor of stale fasl
file: /home/dharmatech/src/larceny-0.97-bin-native-ia32-linux86/lib/Ffi/ffi-linux-x86.sch

Error: no handler for exception #<record &compound-condition>
Compound condition has these components:
#<record &assertion>
#<record &who>
who : "ffi/apply"
#<record &message>
message : " bad arguments.\n"

Terminating program execution.
~ $
----------------------------------------------------------------------

Note that the only difference is the order of the imports.

The '(glut)' library is the one I mentioned in my previous message. :-)

Ed
Felix Klock
2009-12-28 14:58:53 UTC
Permalink
Thanks Ed!

I just filed the problem in Larceny's bug database as Ticket #659:

https://trac.ccs.neu.edu/trac/larceny/ticket/659

-Felix
Post by Eduardo Cavazos
Hello,
----------------------------------------------------------------------
(import (rnrs)
(glut)
(srfi :27 random-bits))
(glutInit (vector 0) (vector ""))
----------------------------------------------------------------------
----------------------------------------------------------------------
(import (rnrs)
(srfi :27 random-bits)
(glut))
(glutInit (vector 0) (vector ""))
----------------------------------------------------------------------
----------------------------------------------------------------------
~ $ rlwrap ~/src/larceny-0.97-bin-native-ia32-linux86/larceny -r6rs
-program /tmp/test-larceny-gl-b.sps
Warning: loading source in favor of stale fasl
file: /home/dharmatech/src/larceny-0.97-bin-native-ia32-linux86/lib/Standard/time.sch
Warning: loading source in favor of stale fasl
file: /home/dharmatech/src/larceny-0.97-bin-native-ia32-linux86/lib/Ffi/ffi-i386.sch
Warning: loading source in favor of stale fasl
file: /home/dharmatech/src/larceny-0.97-bin-native-ia32-linux86/lib/Ffi/ffi-linux-x86.sch
Error: no handler for exception #<record &compound-condition>
#<record &assertion>
#<record &who>
who : "ffi/apply"
#<record &message>
message : " bad arguments.\n"
Terminating program execution.
~ $
----------------------------------------------------------------------
Note that the only difference is the order of the imports.
The '(glut)' library is the one I mentioned in my previous message. :-)
Ed
_______________________________________________
Larceny-users mailing list
https://lists.ccs.neu.edu/bin/listinfo/larceny-users
Eduardo Cavazos
2010-01-04 05:51:13 UTC
Permalink
Post by Felix Klock
https://trac.ccs.neu.edu/trac/larceny/ticket/659
Felix,

Here's a shorter test case.

This script generates the error:

----------------------------------------------------------------------
(import (rnrs)
(srfi :19)
(test-larceny-glut))

(glutInit (vector 0) (vector ""))
----------------------------------------------------------------------

where '(test-larceny-glut)' is:

----------------------------------------------------------------------
(library (test-larceny-glut)

(export glutInit)

(import (rnrs) (primitives foreign-file foreign-procedure))

(define libGLUT (foreign-file "libglut.so.3"))

(define-syntax define-function
(syntax-rules ()
((_ ret name args)
(define name (foreign-procedure (symbol->string 'name) 'args
'ret)))))

(define-function void glutInit (boxed boxed))

)
----------------------------------------------------------------------

Note that SRFI 27 is off the hook; the above is using SRFI 19.

Ed
Eduardo Cavazos
2010-01-04 05:55:52 UTC
Permalink
Post by Eduardo Cavazos
Note that SRFI 27 is off the hook; the above is using SRFI 19.
~ $ rlwrap larceny --err5rs
Larceny v0.97 "Funny in the Head" (Aug 19 2009 06:31:24,
precise:Linux:unified)
larceny.heap, built on Wed Aug 19 06:33:35 EDT 2009
ERR5RS mode (no libraries have been imported)
Post by Eduardo Cavazos
(import (srfi :27))
...

For some reason, the above triggers a load of SRFI 19, even though it's
not in the import list of '(srfi :17)'.

Ed

Loading...