<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>Thank you for the reply, it is appreciated.<BR>
&nbsp;<BR>
I ran the below, per your recommendation.&nbsp; I found it only works if I also specify "--cgc".&nbsp; So, the command-line I ran was:<BR>
"C:\Program Files\MzScheme\mzc.exe" --cgc --cc test_scheme_embed.c<BR>
&nbsp;<BR>
yielding:<BR>mzc v371 [3m], Copyright (c) 2004-2007 PLT Scheme Inc.<BR>"test_scheme_embed.c":<BR>&nbsp;[output to ".\test_scheme_embed.obj"]<BR>
&nbsp;<BR>
followed by:<BR>
"C:\Program Files\MzScheme\mzc.exe" --ld test_scheme_embed.exe test_scheme_embed.obj<BR>
&nbsp;<BR>
yielding:<BR>mzc v371 [3m], Copyright (c) 2004-2007 PLT Scheme Inc.<BR>mzc: not a MzScheme extension filename (doesn't end with .dll): test_scheme_embed.exe<BR>
&nbsp;<BR>
I imagine there's something obvious I'm missing, but I haven't discovered what yet.&nbsp; Any advice appreciated.<BR>
&nbsp;<BR>
Thank you,<BR>
Matthew P.<BR><BR><BR><BR>

<HR id=stopSpelling>
<BR>
&gt; Date: Fri, 30 Nov 2007 10:32:54 -0700<BR>&gt; From: czhu@cs.utah.edu<BR>&gt; To: mvfpadilla@hotmail.com<BR>&gt; CC: plt-scheme@list.cs.brown.edu<BR>&gt; Subject: Re: [plt-scheme] mzc embedding question<BR>&gt; <BR>&gt; Matthew Padilla wrote:<BR>&gt; &gt; Hello,<BR>&gt; &gt; <BR>&gt; &gt; I would like to compile a C++ program that embeds MzScheme, similar to <BR>&gt; &gt; the example given in the online documentation (see example at end of <BR>&gt; &gt; email). I would like to be able to pass it<BR>&gt; &gt; strings representing arbitrary Scheme programs, and have it evaluate them.<BR>&gt; &gt; <BR>&gt; &gt; I am running Microsoft's Visual C++ Express, on a Vista machine. <BR>&gt; &gt; <BR>&gt; &gt; Am I mistaken, or can I use mzc for this purpose? It seems as though <BR>&gt; &gt; mzc makes life easier by resolving linkage issues, etc. (e.g. to <BR>&gt; &gt; MzScheme libraries) but I'm not sure if this is only for<BR>&gt; &gt; extension writing. I've managed to produce .obj files via mzc... but <BR>&gt; &gt; not an .exe.<BR>&gt; <BR>&gt; Sure you can.<BR>&gt; <BR>&gt; mzc --cc yourfile.c<BR>&gt; mzc --ld yourfile.exe yourfile.obj<BR>&gt; <BR>&gt; should work.<BR>&gt; <BR>&gt; Chongkai<BR>&gt; <BR>&gt; <BR>&gt; &gt; <BR>&gt; &gt; I have searched for examples but have found no good ones yet, so I <BR>&gt; &gt; apologize in advance if they have passed me by.<BR>&gt; &gt; <BR>&gt; &gt; Thank you,<BR>&gt; &gt; Matthew P.<BR>&gt; &gt; <BR>&gt; &gt; #include "scheme.h"<BR>&gt; &gt;<BR>&gt; &gt; int main(int argc, char *argv[])<BR>&gt; &gt; {<BR>&gt; &gt; Scheme_Env *e;<BR>&gt; &gt; Scheme_Object *curout;<BR>&gt; &gt; int i;<BR>&gt; &gt; mz_jmp_buf * volatile save, fresh;<BR>&gt; &gt;<BR>&gt; &gt; scheme_set_stack_base(NULL, 1); /* required for OS X, only */<BR>&gt; &gt;<BR>&gt; &gt; e = scheme_basic_env();<BR>&gt; &gt;<BR>&gt; &gt; curout = scheme_get_param(scheme_current_config(), <BR>&gt; &gt; MZCONFIG_OUTPUT_PORT);<BR>&gt; &gt;<BR>&gt; &gt; for (i = 1; i &lt; argc; i++) {<BR>&gt; &gt; save = scheme_current_thread-&gt;error_buf;<BR>&gt; &gt; scheme_current_thread-&gt;error_buf = &amp;fresh;<BR>&gt; &gt; if (scheme_setjmp(scheme_error_buf)) {<BR>&gt; &gt; scheme_current_thread-&gt;error_buf = save;<BR>&gt; &gt; return -1; /* There was an error */<BR>&gt; &gt; } else {<BR>&gt; &gt; Scheme_Object *v = scheme_eval_string(argv[i], e);<BR>&gt; &gt; scheme_display(v, curout);<BR>&gt; &gt; scheme_display(scheme_make_character('\n'), curout);<BR>&gt; &gt; /* read-eval-print loop, implicitly uses the initial Scheme_Env: */<BR>&gt; &gt; scheme_apply(scheme_builtin_value("read-eval-print-loop"), 0, NULL);<BR>&gt; &gt; scheme_current_thread-&gt;error_buf = save;<BR>&gt; &gt; }<BR>&gt; &gt; }<BR>&gt; &gt; return 0;<BR>&gt; &gt; }<BR>&gt; &gt;<BR>&gt; &gt; ------------------------------------------------------------------------<BR>&gt; &gt;<BR>&gt; &gt; _________________________________________________<BR>&gt; &gt; For list-related administrative tasks:<BR>&gt; &gt; http://list.cs.brown.edu/mailman/listinfo/plt-scheme<BR>&gt; &gt; <BR>&gt; <BR><BR></body>
</html>