Created
May 9, 2014 14:30
-
-
Save BitPuffin/f8ad6fa6f43327a84611 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void init(); | |
void test(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Silly test of using scheme as core | |
#include <stdio.h> | |
#include "test.h" | |
int main() { | |
printf("Init\n"); | |
init(); | |
printf("test\n"); | |
test(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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