[gambit-list] Gambit C Interface (FFI)
    Guillaume Cartier 
    gucartier at gmail.com
       
    Sun Sep 16 18:00:22 EDT 2007
    
    
  
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));"))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20070916/24e95d94/attachment.htm>
    
    
More information about the Gambit-list
mailing list