jvm.h (_Jv_GetJavaVM): Declare.

* include/jvm.h (_Jv_GetJavaVM): Declare.
	* include/java-interp.h (_Jv_GetFirstMethod): New function.
	(_Jv_MethodBase::get_method): New method.
	(_Jv_JNIMethod::set_function): New method.
	* jni.cc (_Jv_JNI_UnregisterNatives): New function.
	(_Jv_JNI_RegisterNatives): New function.
	(_Jv_JNIFunctions): Updated for new functions.
	(_Jv_GetJavaVM): New function.
	(_Jv_JNI_GetJavaVM): Use it.  Now static.
	(_Jv_JNI_AttachCurrentThread): Create a new JNIEnv if this thread
	is already a Java thread but does not have a JNIEnv yet.

	* java/lang/natRuntime.cc (_load): Pass the JavaVM to the onload
	function.

From-SVN: r32056
This commit is contained in:
Tom Tromey 2000-02-18 21:22:06 +00:00 committed by Tom Tromey
parent 31e890f0f3
commit 8ade47715e
5 changed files with 135 additions and 14 deletions

View file

@ -135,8 +135,13 @@ java::lang::Runtime::_load (jstring path, jboolean do_search)
void *onload = lt_dlsym (h, "JNI_OnLoad");
if (onload != NULL)
{
// FIXME: need invocation API to get JavaVM.
jint vers = ((jint (*) (...)) onload) (NULL, NULL);
JavaVM *vm = _Jv_GetJavaVM ();
if (vm == NULL)
{
// FIXME: what?
return;
}
jint vers = ((jint (*) (JavaVM *, void *)) onload) (vm, NULL);
if (vers != JNI_VERSION_1_1 && vers != JNI_VERSION_1_2)
{
// FIXME: unload the library.