<div dir="ltr"><div>Hi</div><div><br></div><div>I&#39;m trying to add a primitive c procedure to MzScheme. I can&#39;t show all the code, but I&#39;m basically doing something like this:</div><div>----------------------------------------------------------------------</div>
<div>//.....</div><div>#include &lt;scheme.h&gt;</div><div>#include &quot;base.c&quot;</div><div>//.....</div><div><br></div><div>static Scheme_Object * run_c_proc(int argc, Scheme_Object ** argv) {</div><div>&nbsp;&nbsp;//.....</div>
<div>&nbsp;&nbsp;return scheme_void;</div><div>}</div><div><br></div><div>static int inner_main(Scheme_Env * env, int argc, char ** argv) {</div><div>&nbsp;&nbsp;//.....</div><div>&nbsp;&nbsp;Scheme_Object * proc = scheme_make_prim_w_arity(run_c_proc, &quot;run-c-proc&quot;, 0, 0);</div>
<div>&nbsp;&nbsp;scheme_add_global(&quot;run-c-proc&quot;, proc, env);</div><div>&nbsp;&nbsp;//.....</div><div>&nbsp;&nbsp;return 0;</div><div>}</div><div><br></div><div>int main(int argc, char ** argv) {</div><div>&nbsp;&nbsp;return scheme_main_setup(1, inner_main, argc, argv);</div>
<div>&nbsp;&nbsp;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 &nbsp; ???<span class="Apple-tab-span" style="white-space:pre">                                        </span>0x032294d8 0 + 52597976</div><div>1 &nbsp; PLT_MzScheme &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span>0x01c84b1e scheme_bucket_or_null_from_table + 78</div>
<div>2 &nbsp; PLT_MzScheme &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span>0x01c84b50 scheme_bucket_from_table + 32</div><div>3 &nbsp; PLT_MzScheme &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span>0x01c2eb47 scheme_do_add_global_symbol + 103</div>
<div>4 &nbsp; PLT_MzScheme &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<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>