* libjava.jni/cxxtest.out: New file.
* libjava.jni/cxxtest.cc: New file.
* libjava.jni/cxxtest.java: New file.
* libjava.jni/jni.exp (gcj_jni_test_one): If there is no .c file,
assume there is a .cc file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48012
138bc75d-0d04-0410-961f-
82ee72b054a4
+2001-12-13 Tom Tromey <tromey@redhat.com>
+
+ For PR libgcj/5103:
+ * libjava.jni/cxxtest.out: New file.
+ * libjava.jni/cxxtest.cc: New file.
+ * libjava.jni/cxxtest.java: New file.
+ * libjava.jni/jni.exp (gcj_jni_test_one): If there is no .c file,
+ assume there is a .cc file.
+
2001-12-09 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* libjava.lang/PR3731.out: Adjust output to reflect that "instanceof"
--- /dev/null
+#include <jni.h>
+#include <cxxtest.h>
+
+jobjectArray
+Java_cxxtest_fetch (JNIEnv *env, jobject _this)
+{
+ jclass cls;
+ jfieldID fid;
+ jobjectArray obj;
+
+ cls = env->GetObjectClass (_this);
+ if (! cls)
+ return 0;
+
+ fid = env->GetFieldID (cls, "F", "[Ljava/lang/Object;");
+ if (! fid)
+ return 0;
+
+ obj = reinterpret_cast<jobjectArray> (env->GetObjectField (_this, fid));
+
+ return obj;
+}
+
+
--- /dev/null
+// Test for array field lookup.
+
+public class cxxtest
+{
+ // A field for us to look up.
+ public Object[] F = new Object[7];
+
+ public native Object[] fetch ();
+
+ public void doit ()
+ {
+ System.out.println (F == fetch ());
+ }
+
+ public static void main (String[] args)
+ {
+ cxxtest q = new cxxtest ();
+ q.doit ();
+ }
+
+ static
+ {
+ System.loadLibrary ("cxxtest");
+ }
+}
}
set cfile [file rootname $file].c
+ set cxxflags ""
+ # If there is no `.c' file, assume there is a `.cc' file.
+ if {! [file exists $cfile]} {
+ set cfile [file rootname $file].cc
+ set cxxflags "-lstdc++"
+ }
+
if {! [gcj_jni_compile_c_to_so $cfile]} {
# FIXME
return 0
# We use -l$main because the .so is named the same as the main
# program.
- set args [list "additional_flags=-fjni -L. -l$main"]
+ set args [list "additional_flags=-fjni -L. -l$main $cxxflags"]
if {! [gcj_link $main $main $file $args]} {
# FIXME
return 0