~ chicken-core (chicken-5) /tests/callback-tests.scm
Trap1;;;; callback-tests.scm
2
3(import (only (chicken process-context) command-line-arguments))
4
5(define k1)
6
7(define-external (foo) void
8 (call/cc
9 (lambda (k) (set! k1 k)))
10 (print "hi!"))
11
12#>
13extern void foo();
14static void bar() { foo(); }
15<#
16
17(print "callbacks ...")
18((foreign-safe-lambda void "bar"))
19
20(when (member "twice" (command-line-arguments))
21 (k1 #f))