[plt-scheme] Adding primitive c procedure

From: Erlend Lorentzen (erlendlor at gmail.com)
Date: Thu Jul 24 11:50:22 EDT 2008

Hi

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:
----------------------------------------------------------------------
//.....
#include <scheme.h>
#include "base.c"
//.....

static Scheme_Object * run_c_proc(int argc, Scheme_Object ** argv) {
  //.....
  return scheme_void;
}

static int inner_main(Scheme_Env * env, int argc, char ** argv) {
  //.....
  Scheme_Object * proc = scheme_make_prim_w_arity(run_c_proc, "run-c-proc",
0, 0);
  scheme_add_global("run-c-proc", proc, env);
  //.....
  return 0;
}

int main(int argc, char ** argv) {
  return scheme_main_setup(1, inner_main, argc, argv);
  return 0;
}
---------------------------------------------------------------------

It compiles, but when I try to run it I get the following:

Thread 0 Crashed:
0   ??? 0x032294d8 0 + 52597976
1   PLT_MzScheme                   0x01c84b1e
scheme_bucket_or_null_from_table + 78
2   PLT_MzScheme                   0x01c84b50 scheme_bucket_from_table + 32
3   PLT_MzScheme                   0x01c2eb47 scheme_do_add_global_symbol +
103
4   PLT_MzScheme                   0x01c2ecb2 scheme_add_global + 98

---------------------------------------------------------------------

Any suggestions?

Thanks

----------------------
MzScheme: v4
OS X 10.5.4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080724/24b153d9/attachment.html>

Posted on the users mailing list.