[plt-scheme] collection not found: "scheme" in embedding mzscheme with v4.x
Hi all,
I noticed recently that mzscheme upgraded to a new version. I upgraded
it and found my program broken. I read the Inside PLT scheme and found
that now I need to do scheme_namespace_require so I added the line to
require "scheme/base" but I got an error:
scheme/base: standard-module-name-resolver: collection not found:
"scheme" in any of: () in: scheme/base
Seg fault (internal error) at 0x4
I copied the example code in "Inside PLT scheme" and tried, still the
same problem. Here's the code I use:
<-----------------------------------------------------------------
#include "scheme.h"
static int run(Scheme_Env *e, int argc, char *argv[])
{
Scheme_Object *curout = NULL, *v = NULL, *a[2] = {NULL, NULL};
Scheme_Config *config = NULL;
int i;
mz_jmp_buf * volatile save = NULL, fresh;
MZ_GC_DECL_REG(8);
MZ_GC_VAR_IN_REG(0, e);
MZ_GC_VAR_IN_REG(1, curout);
MZ_GC_VAR_IN_REG(2, save);
MZ_GC_VAR_IN_REG(3, config);
MZ_GC_VAR_IN_REG(4, v);
MZ_GC_ARRAY_VAR_IN_REG(5, a, 2);
MZ_GC_REG();
v = scheme_intern_symbol("scheme/base");
scheme_namespace_require(v);
config = scheme_current_config();
curout = scheme_get_param(config, MZCONFIG_OUTPUT_PORT);
for (i = 1; i < argc; i++) {
save = scheme_current_thread->error_buf;
scheme_current_thread->error_buf = &fresh;
if (scheme_setjmp(scheme_error_buf)) {
scheme_current_thread->error_buf = save;
return -1; /* There was an error */
} else {
v = scheme_eval_string(argv[i], e);
scheme_display(v, curout);
v = scheme_make_char('\n');
scheme_display(v, curout);
/* read-eval-print loop, uses initial Scheme_Env: */
a[0] = scheme_intern_symbol("scheme/base");
a[1] = scheme_intern_symbol("read-eval-print-loop");
v = scheme_dynamic_require(2, a);
scheme_apply(v, 0, NULL);
scheme_current_thread->error_buf = save;
}
}
MZ_GC_UNREG();
return 0;
}
int main(int argc, char *argv[])
{
return scheme_main_setup(1, run, argc, argv);
}
<---------------------------------------------------------------------
I compiled it like this:
mzc --cc --3m foo.c
gcc foo.o -o foo -lmzscheme3m -lm -lpthread -ldl
I can run the mzscheme program as a stand alone program, the version
information is: Welcome to MzScheme v4.0.1 [3m], Copyright (c)
2004-2008 PLT Scheme Inc.
My system is Debian sid. Can anybody tell me what's the problem and
how to solve it? Many thanks!
--
pluskid