<div>Help needed!</div>
<div> </div>
<div>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)</div>
<div> </div>
<div>With this function defined in my gambcini :</div>
<div> </div>
<div>(define (C . rest)<br> (let loop ((n (if (null? rest) 1 (car rest))))<br> (if (> n 0)<br> (begin<br> (write n) (newline)<br> (compile-file "c")<br> (load "c")
<br> (make-S2)<br> (loop (- n 1))))))</div>
<div> </div>
<div>I run (C 50) maybe a couple times and always end up getting a random crash often the first time</div>
<div> </div>
<div>File c.scm :</div>
<div>
<p>(c-declare<br> "struct S2_<br> {<br> int x;<br> int y;<br> };<br> typedef struct S2_ S2;"<br> )</p>
<p>(c-define-type S2 (type "S2"))</p>
<p>(define make-S2<br> (c-lambda () S2<br> "___result_voidstar = calloc(1, sizeof(S2));"))<br></p></div>