[plt-scheme] Embedding MzScheme in Java

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Aug 9 09:27:39 EDT 2006

At Tue, 08 Aug 2006 15:02:17 -0700, Randal Walser wrote:
> JNIEXPORT void JNICALL
> Java_test_init_mzscheme(JNIEnv* env, jobject obj) {
> 
>     int dummy;
>     Scheme_Env* e;
> 
>     scheme_set_stack_base(&dummy,1);
>     // scheme_set_stack_base(NULL,1);
> 
>     e = scheme_basic_env();
> 
> ...
> 
> }

That looks right for as far as you're getting. (There could be a
problem when scheme_basic_env() returns, because there's no guarantee
that `dummy' is deeper in the stack than `e'.)

I tried embedding MzScheme in a little Windows app --- even starting it
in a thread other than the main thread --- and scheme_basic_env()
worked. So, I think I'm probably missing something about the
environment provided by the JVM.

One more thought: You mentioned that you re-build the DLLs with /MD.
But are you otherwise using the DLLs that we include in a distribution,
or are you building yourself?

Matthew



Posted on the users mailing list.