Skip to content

Instantly share code, notes, and snippets.

@BitPuffin
Created May 9, 2014 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BitPuffin/f8ad6fa6f43327a84611 to your computer and use it in GitHub Desktop.
Save BitPuffin/f8ad6fa6f43327a84611 to your computer and use it in GitHub Desktop.
void init();
void test();
// Silly test of using scheme as core
#include <stdio.h>
#include "test.h"
int main() {
printf("Init\n");
init();
printf("test\n");
test();
}
% make
cd src && csc -e -c test.scm && clang -I../include -c init.c
libtool -static src/test.o src/init.o -o lib/libtest.a
clang -Iinclude -Llib -lchicken -ltest main.c -o test
Isaks-MacBook-Pro% ./test
Init
Initializing chickentest
zsh: segmentation fault ./test
#include <chicken/chicken.h>
#include <stdio.h>
#include "test.h"
void init() {
printf("Initializing chicken");
if(!CHICKEN_initialize(0, 0, 0, C_toplevel)) {
printf("Could not initialize chicken, wtf \n");
}
}
(define-external (test) void
(write 'hello-world))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment