summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2003-02-03 21:23:59 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2003-02-03 21:23:59 +0000
commit119a12ff1b0517c5684796cb4a7c41feea2ab287 (patch)
tree41214ef4662ff54a4a3264358d4ba31c3cb1da97
parent48831167e2e28fb95355c426dcd700f74b32a1c9 (diff)
downloadgcc-119a12ff1b0517c5684796cb4a7c41feea2ab287.tar.gz
2003-02-03 Ranjit Mathew <rmathew@hotmail.com>
* java/lang/natRuntime.cc (java::lang::Runtime::_load)): Take care of the fact that on Win32, JNI_OnLoad is an "stdcall" function and could also have been exported as "JNI_OnLoad@8" (MinGW) or "_JNI_OnLoad@8" (MSVC). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@62348 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libjava/ChangeLog7
-rw-r--r--libjava/java/lang/natRuntime.cc17
2 files changed, 22 insertions, 2 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 11ba2edd366..8a5597a9833 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,5 +1,12 @@
2003-02-03 Ranjit Mathew <rmathew@hotmail.com>
+ * java/lang/natRuntime.cc (java::lang::Runtime::_load)): Take care
+ of the fact that on Win32, JNI_OnLoad is an "stdcall" function and
+ could also have been exported as "JNI_OnLoad@8" (MinGW) or
+ "_JNI_OnLoad@8" (MSVC).
+
+2003-02-03 Ranjit Mathew <rmathew@hotmail.com>
+
* resolve.cc (_Jv_JNIMethod::ncode): Use stdcall calling
convention on Win32 to invoke native JNI methods.
diff --git a/libjava/java/lang/natRuntime.cc b/libjava/java/lang/natRuntime.cc
index f74a1e76bcf..09f1e04f361 100644
--- a/libjava/java/lang/natRuntime.cc
+++ b/libjava/java/lang/natRuntime.cc
@@ -1,6 +1,6 @@
// natRuntime.cc - Implementation of native side of Runtime class.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -241,6 +241,19 @@ java::lang::Runtime::_load (jstring path, jboolean do_search)
add_library (h);
void *onload = lt_dlsym (h, "JNI_OnLoad");
+
+#ifdef WIN32
+ // On Win32, JNI_OnLoad is an "stdcall" function taking two pointers
+ // (8 bytes) as arguments. It could also have been exported as
+ // "JNI_OnLoad@8" (MinGW) or "_JNI_OnLoad@8" (MSVC).
+ if (onload == NULL)
+ {
+ onload = lt_dlsym (h, "JNI_OnLoad@8");
+ if (onload == NULL)
+ onload = lt_dlsym (h, "_JNI_OnLoad@8");
+ }
+#endif /* WIN32 */
+
if (onload != NULL)
{
JavaVM *vm = _Jv_GetJavaVM ();
@@ -249,7 +262,7 @@ java::lang::Runtime::_load (jstring path, jboolean do_search)
// FIXME: what?
return;
}
- jint vers = ((jint (*) (JavaVM *, void *)) onload) (vm, NULL);
+ jint vers = ((jint (JNICALL *) (JavaVM *, void *)) onload) (vm, NULL);
if (vers != JNI_VERSION_1_1 && vers != JNI_VERSION_1_2
&& vers != JNI_VERSION_1_4)
{