Created
October 1, 2019 19:06
-
-
Save hsjunnesson/847927b2c48074457d99003c6cec263a to your computer and use it in GitHub Desktop.
Embedded Racket in C
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 "scheme.h" | |
#include "base.c" | |
static int run(Scheme_Env* e, int argc, char* argv[]) { | |
scheme_env = e; | |
declare_modules(e); | |
scheme_namespace_require(scheme_intern_symbol("racket/base")); | |
Scheme_Config* config = scheme_current_config(); | |
Scheme_Object *curout = scheme_get_param(config, MZCONFIG_OUTPUT_PORT); | |
Scheme_Object* v = scheme_eval_string("(+ 1 2)", scheme_env); | |
scheme_display(v, curout); | |
scheme_display(scheme_make_char('\n'), curout); | |
scheme_eval_string("(require \"test.rkt\")", scheme_env); | |
return 0; | |
} | |
int main(int argc, char* argv[]) { | |
scheme_main_setup(1, run, argc, argv); | |
return 0; | |
} |
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
#lang racket | |
(printf "Hello World!\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment