[plt-scheme] Bus error on scheme_initialize

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Mar 30 09:33:58 EST 2005

At Tue, 29 Mar 2005 21:33:23 -0700, Phil Windley wrote:
> 1.) Is there something obviously dumb about what happening above?

No, I can't see anything wrong at all. I think maybe we need to see
more of your file to know what's going wrong.

> 2.) If not, then does just adding the global to the table exercise the 
> code for the function tied to the global (gdbm_open in this case) in 
> such a way that I should look there for the problem?

No, it shouldn't.

> 3.) Other ideas?

Below is a complete (but useless!) extension built around your
function. This works for me when I compile with

  mzc --cc test.c
  mzc --ld test.dylib test.o

and then use `load-extension' on "test.dylib".

Does this one work for you? If so, maybe the difference will suggest
something, or maybe the next step is sending a more complete program to
the list. If my version doesn't work for you, then a stack trace is
probably in order to help me figure out what's wrong.



#include <escheme.h>

static Scheme_Type scheme_gdbm_file_type;

static Scheme_Object *scheme_gdbm_open(Scheme_Object **a, int c)
  return scheme_void;

Scheme_Object *scheme_initialize(Scheme_Env *env) {

   Scheme_Object *v;

/* type for GDBM_FILE */

/* Exported functions */
    v = scheme_make_prim_w_arity(scheme_gdbm_open, "gdbm:open", 1, 3);
    scheme_add_global("gdbm:open", v, env);

    return scheme_void;

Scheme_Object *scheme_reload(Scheme_Env *env) {
  return scheme_void;
  /* Likely more useful: do everything that's in
     scheme_initialize, except making the type. */

Scheme_Object *scheme_module_name() {
  return scheme_false;

Posted on the users mailing list.