[plt-scheme] Trouble embedding scheme on Mac OS X

From: Norbert Zeh (nzeh at cs.dal.ca)
Date: Fri Sep 24 20:25:22 EDT 2004

Hi folks:

I am having trouble building an application that has PLT scheme 
embedded in it.  My environment is OS X 10.3.  I tried to compile and 
run the first bit of sample code from "Inside PLT Scheme":

#include <stdio.h>
#include <scheme.h>

int main (int argc, char * argv[]) {
	
	Scheme_Env *e = scheme_basic_env();
	Scheme_Object *curout = scheme_get_param(scheme_config, 
MZCONFIG_OUTPUT_PORT);
	int i;
	for(i = 1; i < argc; i++) {
		if(scheme_setjmp(scheme_error_buf)) {
			return -1;
		} else {
			Scheme_Object *v = scheme_eval_string(argv[i], e);
			scheme_display(v, curout);
			scheme_display(scheme_make_character('\n'), curout);
			scheme_apply(scheme_builtin_value("read-eval-print-loop"), 0, NULL);
		}
	}
	return 0;
}

It compiles and links fine; but when I run it, I get a "bus error".  
This even happens when I build the following piece of code:

#include <stdio.h>
#include <scheme.h>

int main (int argc, char * argv[]) {
	
	Scheme_Env *e = scheme_basic_env();
	return 0;
}

So something weird seems to happen inside scheme_basic_env().  Any idea 
what I may be doing wrong?

In case this matters, I use the following line to build the code:

gcc -o test_scheme test_scheme.c -lmzscheme -lmzgc -L../../plt/include 
-I../../plt/lib

Thanks,
Norbert



Posted on the users mailing list.