Welcome to the CHICKEN Scheme pasting service

foreign structs added by Bunny351 on Mon Nov 6 12:35:50 2023

(import (chicken foreign))
(foreign-declare "struct foo {int x;}; 
void bar(struct foo x) {printf(\"%d\\n\", x.x);}
struct foo baz(int x) {struct foo y;y.x=x;return y;}")
(define bar (foreign-lambda void "bar" (struct "foo")))

(define safe-bar (foreign-safe-lambda void "bar" (struct "foo")))

(define baz (foreign-lambda (struct "foo") "baz" int))
(let ((x (baz 123)))
  (print x)
  (bar x)
  (safe-bar x)
  (bar (foreign-value "(struct foo){99}" (struct foo)))
  (let-location ((f1 (struct foo) (baz 100)))
    (bar f1)))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Name of the CHICKEN interpreter:
Visually impaired? Let me spell it for you (wav file) download WAV