natSharedLibLoader.cc (init): `libname' now a String.
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. From-SVN: r69622
This commit is contained in:
parent
ffd94572f4
commit
8ec880749f
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user