Welcome to the CHICKEN Scheme pasting service
Example pasted by Kooda on Sat Feb 25 12:53:51 2017
;; comp.scm ;; compiled with `csc -s comp.scm` (import foreign) (define-external x1 int 0) (define-external x2 int 0) (foreign-declare "void func(int* x, int* y){ *x = 21; *y = 42; }") (define (func) ((foreign-lambda* void () "func(&x1, &x2);")) (values x1 x2)) ;; csi interaction #;1> (load "comp.so") ; loading comp.so ... #;2> (func) 21 42 ; 2 values
Same example, with let-location added by Kooda on Sat Feb 25 13:06:45 2017
(import foreign) (foreign-declare "void func(int* x, int* y) { *x = 21; *y = 42; }") (define (func) (let-location ((x1 int) (x2 int)) ((foreign-lambda void func (c-pointer int) (c-pointer int)) (location x1) (location x2)) (values x1 x2)))