[plt-scheme] mzc embedding question
Hello,
I would like to compile a C++ program that embeds MzScheme, similar to the example given in the online documentation (see example at end of email). I would like to be able to pass it
strings representing arbitrary Scheme programs, and have it evaluate them.
I am running Microsoft's Visual C++ Express, on a Vista machine.
Am I mistaken, or can I use mzc for this purpose? It seems as though mzc makes life easier by resolving linkage issues, etc. (e.g. to MzScheme libraries) but I'm not sure if this is only for
extension writing. I've managed to produce .obj files via mzc... but not an .exe.
I have searched for examples but have found no good ones yet, so I apologize in advance if they have passed me by.
Thank you,
Matthew P.
#include "scheme.h"int main(int argc, char *argv[]){ Scheme_Env *e; Scheme_Object *curout; int i; mz_jmp_buf * volatile save, fresh; scheme_set_stack_base(NULL, 1); /* required for OS X, only */ e = scheme_basic_env(); curout = scheme_get_param(scheme_current_config(), MZCONFIG_OUTPUT_PORT); for (i = 1; i < argc; i++) { save = scheme_current_thread->error_buf; scheme_current_thread->error_buf = &fresh; if (scheme_setjmp(scheme_error_buf)) { scheme_current_thread->error_buf = save; return -1; /* There was an error */ } else { Scheme_Object *v = scheme_eval_string(argv[i], e); scheme_display(v, curout); scheme_display(scheme_make_character('\n'), curout); /* read-eval-print loop, implicitly uses the initial Scheme_Env: */ scheme_apply(scheme_builtin_value("read-eval-print-loop"), 0, NULL); scheme_current_thread->error_buf = save; } } return 0;}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20071130/0ae1129a/attachment.html>