This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: fix for PR gcj/150


I'm checking in the appended patch, which fixes PR gcj/150

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.

Tom

Index: java/lang/natRuntime.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/natRuntime.cc,v
retrieving revision 1.8
diff -u -r1.8 natRuntime.cc
--- natRuntime.cc	2000/02/10 00:17:10	1.8
+++ natRuntime.cc	2000/02/15 07:39:02
@@ -108,9 +108,18 @@
   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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]