small embedding example added by Kooda on Tue May 11 09:45:55 2021
embed-scm.scm (import (chicken platform) (chicken foreign)) (define-external (scheme_test (int x)) int (* x 2)) ;; necessary to return to C after CHICKEN_run (return-to-host) =============== embed-c.c #include <stdio.h> #include <chicken.h> int scheme_test(int t0); int main() { CHICKEN_run(C_toplevel); printf("scheme_test(21) = %d\n", scheme_test(21)); return 0; } =============== Build and run: csc -ce embed-scm.scm # using csc here for include dirs and linker options, but you can use your C compiler with the necessary options as well. csc embed-c.c embed-scm.o ./embed-c