]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re GNATS gcj/150 (System.loadLibrary() semantics arn't the same as in the JDK)
authorTom Tromey <tromey@cygnus.com>
Tue, 15 Feb 2000 07:53:11 +0000 (07:53 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Tue, 15 Feb 2000 07:53:11 +0000 (07:53 +0000)
* java/lang/natRuntime.cc (_load): On Unix, prefix library name
with `lib' for loadLibrary.  Fixes PR gcj/150.

From-SVN: r31976

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

index 0a9aa3e3e51993b993cecc710fb3fd6ef9eca526..3623bf7d8860bd99de92da794d95cc7694573e50 100644 (file)
@@ -1,3 +1,8 @@
+2000-02-15  Tom Tromey  <tromey@cygnus.com>
+
+       * java/lang/natRuntime.cc (_load): On Unix, prefix library name
+       with `lib' for loadLibrary.  Fixes PR gcj/150.
+
 2000-02-14  Warren Levy  <warrenl@cygnus.com>
 
        * gnu/gcj/math/MPN.java(findLowestBit): Made methods public.
index f21a81f10502cbe74251a53091995be58718630b..cc693858d2d4a74770f8aeef05bddd5e99a05a4b 100644 (file)
@@ -108,9 +108,18 @@ java::lang::Runtime::_load (jstring path, jboolean do_search)
   using namespace java::lang;
 #ifdef USE_LTDL
   jint len = _Jv_GetStringUTFLength (path);
-  char buf[len + 1];
-  jsize total = JvGetStringUTFRegion (path, 0, path->length(), buf);
-  buf[total] = '\0';
+  char buf[len + 1 + 3];
+  int offset = 0;
+#ifndef WIN32
+  // On Unix boxes, prefix library name with `lib', for loadLibrary.
+  if (do_search)
+    {
+      strcpy (buf, "lib");
+      offset = 3;
+    }
+#endif
+  jsize total = JvGetStringUTFRegion (path, 0, path->length(), &buf[offset]);
+  buf[offset + total] = '\0';
   // FIXME: make sure path is absolute.
   lt_dlhandle h = do_search ? lt_dlopenext (buf) : lt_dlopen (buf);
   if (h == NULL)