OSDN Git Service

* java/lang/natRuntime.cc (_Jv_FindSymbolInExecutable): Return
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Jun 2001 23:22:02 +0000 (23:22 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Jun 2001 23:22:02 +0000 (23:22 +0000)
NULL if no library on the list has the symbol.
(init): Call add_library on the program itself.
* prims.cc (JvRunMain): Initialize Runtime before searching for
`main'.
(_Jv_RunMain): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43413 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/java/lang/natRuntime.cc
libjava/prims.cc

index c50caf8..9d20d86 100644 (file)
@@ -1,5 +1,14 @@
 2001-06-15  Tom Tromey  <tromey@redhat.com>
 
+       * java/lang/natRuntime.cc (_Jv_FindSymbolInExecutable): Return
+       NULL if no library on the list has the symbol.
+       (init): Call add_library on the program itself.
+       * prims.cc (JvRunMain): Initialize Runtime before searching for
+       `main'.
+       (_Jv_RunMain): Likewise.
+
+2001-06-15  Tom Tromey  <tromey@redhat.com>
+
        * jni.cc (ClassClass): Removed; updated all users.
        (ObjectClass): Likewise.
        (ThrowableClass): Likewise.
index 20005b9..cdd44a4 100644 (file)
@@ -69,7 +69,7 @@ _Jv_FindSymbolInExecutable (const char *symname)
        return r;
     }
 
-  return lt_dlsym (NULL, symname);
+  return NULL;
 }
 
 #else
@@ -199,6 +199,9 @@ java::lang::Runtime::init (void)
   finalize_on_exit = false;
 #ifdef USE_LTDL
   lt_dlinit ();
+  lt_dlhandle self = lt_dlopen (NULL);
+  if (self != NULL)
+    add_library (self);
 #endif
 }
 
index f112812..eac47e5 100644 (file)
@@ -1008,6 +1008,10 @@ JvRunMain (jclass klass, int argc, const char **argv)
   _Jv_ThisExecutable (argv[0]);
 #endif
 
+  // Get the Runtime here.  We want to initialize it before searching
+  // for `main'; that way it will be set up if `main' is a JNI method.
+  java::lang::Runtime *rtime = java::lang::Runtime::getRuntime ();
+
   main_thread = _Jv_AttachCurrentThread (JvNewStringLatin1 ("main"), NULL);
   arg_vec = JvConvertArgv (argc - 1, argv + 1);
   runFirst (klass, arg_vec);
@@ -1015,7 +1019,7 @@ JvRunMain (jclass klass, int argc, const char **argv)
 
   int status = (int) java::lang::ThreadGroup::had_uncaught_exception;
     
-  java::lang::Runtime::getRuntime ()->_exit (status);
+  rtime->_exit (status);
 }
 
 void
@@ -1031,6 +1035,10 @@ _Jv_RunMain (const char *name, int argc, const char **argv, bool is_jar)
   _Jv_ThisExecutable (exec_name);
 #endif
 
+  // Get the Runtime here.  We want to initialize it before searching
+  // for `main'; that way it will be set up if `main' is a JNI method.
+  java::lang::Runtime *rtime = java::lang::Runtime::getRuntime ();
+
   main_thread = _Jv_AttachCurrentThread (JvNewStringLatin1 ("main"), NULL);
 
   if (is_jar)
@@ -1061,7 +1069,7 @@ _Jv_RunMain (const char *name, int argc, const char **argv, bool is_jar)
 
   int status = (int) java::lang::ThreadGroup::had_uncaught_exception;
 
-  java::lang::Runtime::getRuntime ()->exit (status);
+  rtime->exit (status);
 }
 
 \f