Foreign func #2 added by chocodot on Mon May 18 21:22:33 2015
// main.c #include <stdio.h> #include <stdint.h> #include <stdbool.h> #include "chicken.h" double get_time() { return 3.0; } static char result[4096]; int main(int argc, char** argv) { size_t size; printf("Hello\n"); C_word module; CHICKEN_run(C_toplevel); int success; while (1) { success = CHICKEN_eval_string_to_string("(get-time)", result, 4096); if (!success) CHICKEN_get_error_message(result, 4096); printf("Result: %s", result); } } // makefile all: csc -t test.scm -o test.c -embedded gcc -DC_EMBEDDED main.c test.c -L./ -lchicken -lm -ldl -o test ./test ; test.scm (define get-time (foreign-lambda double get_time))