diff options
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 8 | ||||
-rw-r--r-- | libjava/gnu/gcj/runtime/SharedLibLoader.java | 7 | ||||
-rw-r--r-- | libjava/gnu/gcj/runtime/natSharedLibLoader.cc | 13 |
3 files changed, 20 insertions, 8 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 2942cb9..8bc4dc7 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,11 @@ +2003-07-20 Steve Pribyl <steve@netfuel.com.> + + * gnu/gcj/runtime/natSharedLibLoader.cc (init): `libname' now a + String. Put dlerror() message into exception. + Include UnsatisfiedLinkError. + * gnu/gcj/runtime/SharedLibLoader.java (init): `libname' now a + String. Now native. + 2003-07-20 Tom Tromey <tromey@redhat.com> * java/lang/Runtime.java: Comment fix. diff --git a/libjava/gnu/gcj/runtime/SharedLibLoader.java b/libjava/gnu/gcj/runtime/SharedLibLoader.java index 40d041d..cfcd04e 100644 --- a/libjava/gnu/gcj/runtime/SharedLibLoader.java +++ b/libjava/gnu/gcj/runtime/SharedLibLoader.java @@ -45,12 +45,7 @@ public class SharedLibLoader extends ClassLoader init(libname, 0); } - void init(String libname, int flags) - { - init(libname.getBytes(), flags); - } - - native void init(byte[] libname, int flags); + native void init(String libname, int flags); public Class loadClass(String name) throws ClassNotFoundException diff --git a/libjava/gnu/gcj/runtime/natSharedLibLoader.cc b/libjava/gnu/gcj/runtime/natSharedLibLoader.cc index 5d9e02a..49bcfb4 100644 --- a/libjava/gnu/gcj/runtime/natSharedLibLoader.cc +++ b/libjava/gnu/gcj/runtime/natSharedLibLoader.cc @@ -14,6 +14,7 @@ details. */ #include <gnu/gcj/runtime/SharedLibLoader.h> #include <java/io/IOException.h> #include <java/lang/UnsupportedOperationException.h> +#include <java/lang/UnsatisfiedLinkError.h> #ifdef HAVE_DLOPEN #include <dlfcn.h> @@ -45,10 +46,14 @@ struct SharedLibDummy #endif void -gnu::gcj::runtime::SharedLibLoader::init(jbyteArray libname, jint flags) +gnu::gcj::runtime::SharedLibLoader::init(jstring libname, jint flags) { #ifdef HAVE_DLOPEN - char *lname = (char*) elements(libname); + jint len = _Jv_GetStringUTFLength (libname); + char lname[len + 1]; + JvGetStringUTFRegion (libname, 0, libname->length(), lname); + lname[len] = '\0'; + if (flags==0) flags = RTLD_LAZY; JvSynchronize dummy1(&java::lang::Class::class$); @@ -59,6 +64,10 @@ gnu::gcj::runtime::SharedLibLoader::init(jbyteArray libname, jint flags) if (h == NULL) { const char *msg = dlerror(); + jstring str = JvNewStringLatin1 (lname); + str = str->concat (JvNewStringLatin1 (": ")); + str = str->concat (JvNewStringLatin1 (msg)); + throw new java::lang::UnsatisfiedLinkError (str); } handler = (gnu::gcj::RawData*) h; #else |