[plt-scheme] Binding C-Structs Containing Fixed-Size Arrays with the FFI
I've poked around a bit more, and I hit the same crash even without
doing the make-cstruct-type stuff. I though that the abstraction
provided by types defined with define-cstruct was 'safe' (since it
doesn't even require (unsafe!)), but this crashes:
#lang scheme/base
(require scheme/foreign)
(define-cstruct _bar
((x0 _float)
(x1 _float)
(x2 _float)
(x3 _float)))
(define-cstruct _foo
((a _bar)
(b _bar)))
(define s
(make-foo (make-bar 10. 20. 30. 40.)
(make-bar 11. 22. 33. 44.)))
(collect-garbage)
(set-bar-x0! (foo-b s) (begin (collect-garbage) 0) 42.)
When I run it in mzscheme v4.1.4 I get:
SIGSEGV fault on 0x1
pid # 9099 run gdb "gdb ./mzscheme3m 9099" or kill process.
Is this a bug?
Henk