Invocation API (JNI) completely broken

Martin Kahlert martin.kahlert@infineon.com
Mon Oct 29 23:58:00 GMT 2001


Hi Bryce,
thanks for your fast answer!
On Tue, Oct 30, 2001 at 11:26:27AM +1300, Bryce McKinlay wrote:
> Martin Kahlert wrote:
>> >Once upon a time JNI worked for me in 3.1.
> >
> >Now it bombs over and over:
> >
> >The first problem was
> >clinit_name = init_name = finit_name == NULL
> >
>> Try adding a call to _Jv_CreateJavaVM near the top of JNI_CreateJavaVM, 
> and removing the _Jv_JNI_Init call. Eventually we want to unify all the 
> argument processing in one place, but just passing NULL ought to work 
> for now. Let me know if that works for you and if so I'll check it in.

In fact my second question would have been how to unify these
initialization routines.
I tried the following patch as you suggested and it works for the 
small test i gave in the original post.
Furthermore it even works with my large application!
So i suggest committing it. It works a lot better than the jni.cc
already present (and probably won't hurt a lot of people if it doesn't work).
--- jni.cc.orig	Tue Oct 30 07:24:29 2001
+++ jni.cc	Tue Oct 30 07:28:07 2001
@@ -2108,6 +2108,9 @@
 JNI_CreateJavaVM (JavaVM **vm, void **penv, void *args)
 {
 JvAssert (! the_vm);
+
+ _Jv_CreateJavaVM(NULL);
+
 // FIXME: synchronize
 JavaVM *nvm = (JavaVM *) _Jv_MallocUnchecked (sizeof (JavaVM));
 if (nvm == NULL)
@@ -2162,8 +2165,6 @@
 
 the_vm = nvm;
 *vm = the_vm;
-
- _Jv_JNI_Init();
 
 return 0;
 }
Thanks a lot again,
Martin.
-- 
The early bird catches the worm. If you want something else for 
breakfast, get up later.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /