<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>Hello,<BR>
<BR>
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<BR>
strings representing arbitrary Scheme programs, and have it evaluate them.<BR>
<BR>
I am running Microsoft's Visual C++ Express, on a Vista machine. <BR>
<BR>
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 <BR>
extension writing. I've managed to produce .obj files via mzc... but not an .exe.<BR>
<BR>
I have searched for examples but have found no good ones yet, so I apologize in advance if they have passed me by.<BR>
<BR>
Thank you,<BR>
Matthew P.<BR>
<BR>
<FONT size=1>#include "scheme.h"<BR><BR>int main(int argc, char *argv[])<BR>{<BR> Scheme_Env *e;<BR> Scheme_Object *curout;<BR> int i;<BR> mz_jmp_buf * volatile save, fresh;<BR><BR> scheme_set_stack_base(NULL, 1); /* required for OS X, only */<BR><BR> e = scheme_basic_env();<BR><BR> curout = scheme_get_param(scheme_current_config(), MZCONFIG_OUTPUT_PORT);<BR><BR> for (i = 1; i < argc; i++) {<BR> save = scheme_current_thread->error_buf;<BR> scheme_current_thread->error_buf = &fresh;<BR> if (scheme_setjmp(scheme_error_buf)) {<BR> scheme_current_thread->error_buf = save;<BR> return -1; /* There was an error */<BR> } else {<BR> Scheme_Object *v = scheme_eval_string(argv[i], e);<BR> scheme_display(v, curout);<BR> scheme_display(scheme_make_character('\n'), curout);<BR> /* read-eval-print loop, implicitly uses the initial Scheme_Env: */<BR> scheme_apply(scheme_builtin_value("read-eval-print-loop"), 0, NULL);<BR> scheme_current_thread->error_buf = save;<BR> }<BR> }<BR> return 0;<BR>}<BR></FONT><BR></body>
</html>