Trivial callback example added by wasamasa on Fri May 20 16:39:55 2016

;; foo.scm

(import foreign)

(define-external (scheme_function (int x) (int y)) void
  (print "..."))

#>
extern void run_callback();
<#

(define run_callback (foreign-safe-lambda void "run_callback"))

(run_callback)

;; bar.c

extern void scheme_function(int x, int y);

void test(void (*f)(int x, int y)) {
    f(1, 2);
}

void run_callback() {
    test(scheme_function);
}

;; csc foo.scm bar.c -o foo && ./foo