-
-
Save jgarte/d7b0a47c3f669e1d628f58494ec06535 to your computer and use it in GitHub Desktop.
Calling Gambit-C scheme functions from C
This file contains hidden or 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 <stdio.h> | |
#define ___VERSION 406001 | |
#include "gambit.h" | |
#include "somescheme.h" | |
#define SCHEME_LIBRARY_LINKER ____20_somescheme__ | |
___BEGIN_C_LINKAGE | |
extern ___mod_or_lnk SCHEME_LIBRARY_LINKER (___global_state_struct*); | |
___END_C_LINKAGE | |
int main(int argc, char** argv) { | |
printf("Hello World, this is from C\n"); | |
___setup_params_struct setup_params; | |
___setup_params_reset (&setup_params); | |
setup_params.version = ___VERSION; | |
setup_params.linker = SCHEME_LIBRARY_LINKER; | |
___setup (&setup_params); | |
hello_from_scheme(); | |
___cleanup(); | |
return 0; | |
} |
This file contains hidden or 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
extern void hello_from_scheme(void); |
This file contains hidden or 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
(c-define (hello) () void "hello_from_scheme" "extern" | |
(write "Hello From Scheme") | |
(newline)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment