Help needed!
I am trying to understand Gambit's C interface and I have this very simple code that crashes and have no clue why. Anyone has any idea? (Gambit 4.0.0)
With this function defined in my gambcini :
(define (C . rest) (let loop ((n (if (null? rest) 1 (car rest)))) (if (> n 0) (begin (write n) (newline) (compile-file "c") (load "c") (make-S2) (loop (- n 1))))))
I run (C 50) maybe a couple times and always end up getting a random crash often the first time
File c.scm :
(c-declare "struct S2_ { int x; int y; }; typedef struct S2_ S2;" )
(c-define-type S2 (type "S2"))
(define make-S2 (c-lambda () S2 "___result_voidstar = calloc(1, sizeof(S2));"))