[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Java JNI && MzScheme?



Hy all,

I'm trying to create a Windows DLL that implements a NATIVE method of a Java class (see JNI documentation) and which should embed inside the well-known MzScheme interpreter. 

I execute in my DLL the following action :

JNIEXPORT jstring JNICALL Java_PlasmServer_Eval(JNIEnv *env, jclass obj, jstring cmd)
{
	Scheme_Env* env=scheme_basic_env();//PROBLEM HERE!!!
	[...]
}

it causes an "violation error" during the evauluation of "scheme_add_embedded_builtins" function:

	void scheme_add_embedded_builtins(Scheme_Env *env)
	{
		#define EVAL_ONE_STR(str) scheme_eval_string(str, env)
		#define EVAL_ONE_SIZED_STR(str, len) scheme_eval_compiled_sized_string(str, len, env)
		#define JUST_DEFINED(name) primitive_syntax_through_scheme(#name, env)
		#define JUST_DEFINED_FUNC(name) primitive_function_through_scheme(#name, env)
		#define JUST_DEFINED_KEY(name) primitive_syntax_through_scheme(#name, env)
		#define JUST_DEFINED_COND(name) primitive_cond_through_scheme(#name, env)
		#define JUST_DEFINED_QQ(name) JUST_DEFINED_KEY(name)

		#if USE_COMPILED_MACROS
		# include "cmacro.inc"
		#else
		# include "macro.inc"
		#endif
	}


executing the EVAL_ONE_STR(str) of cmacro.inc file  (the same for macro.inc file if I define MZSCHEME_SOMETHING_OMITTED to avoid the use of precompiled macros). In particular it blocks on  ěthe first expression:

	EVAL_ONE_STR(...); 
	JUST_DEFINED_QQ(quasiquote);

The strange thing is that this error seems to depend on which is the main process I'm executing (I mean the executable that links my DLL).
If I create a simple application all is ok. If the same DLL is used (say linked and executed) by the Java Virtual Machine I get an error.

A request of help to all PLT... 

Thank you.
Giorgio Scorzelli.