<div dir="ltr"><div>Hi</div><div><br></div><div>I'm trying to add a primitive c procedure to MzScheme. I can't show all the code, but I'm basically doing something like this:</div><div>----------------------------------------------------------------------</div>
<div>//.....</div><div>#include <scheme.h></div><div>#include "base.c"</div><div>//.....</div><div><br></div><div>static Scheme_Object * run_c_proc(int argc, Scheme_Object ** argv) {</div><div> //.....</div>
<div> return scheme_void;</div><div>}</div><div><br></div><div>static int inner_main(Scheme_Env * env, int argc, char ** argv) {</div><div> //.....</div><div> Scheme_Object * proc = scheme_make_prim_w_arity(run_c_proc, "run-c-proc", 0, 0);</div>
<div> scheme_add_global("run-c-proc", proc, env);</div><div> //.....</div><div> return 0;</div><div>}</div><div><br></div><div>int main(int argc, char ** argv) {</div><div> return scheme_main_setup(1, inner_main, argc, argv);</div>
<div> return 0;</div><div>}</div><div>---------------------------------------------------------------------</div><div><br></div><div>It compiles, but when I try to run it I get the following:</div><div><br></div><div>Thread 0 Crashed:</div>
<div>0 ???<span class="Apple-tab-span" style="white-space:pre">                                        </span>0x032294d8 0 + 52597976</div><div>1 PLT_MzScheme <span class="Apple-tab-span" style="white-space:pre">        </span>0x01c84b1e scheme_bucket_or_null_from_table + 78</div>
<div>2 PLT_MzScheme <span class="Apple-tab-span" style="white-space:pre">        </span>0x01c84b50 scheme_bucket_from_table + 32</div><div>3 PLT_MzScheme <span class="Apple-tab-span" style="white-space:pre">        </span>0x01c2eb47 scheme_do_add_global_symbol + 103</div>
<div>4 PLT_MzScheme <span class="Apple-tab-span" style="white-space:pre">        </span>0x01c2ecb2 scheme_add_global + 98</div><div><br></div><div>---------------------------------------------------------------------</div>
<div><br></div><div>Any suggestions?</div><div><br></div><div>Thanks</div><div><br></div><div>----------------------</div><div>MzScheme: v4</div><div>OS X 10.5.4</div></div>