bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22717] Runtime.nativeLoad() needs a ClassLoader parameter


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22717] Runtime.nativeLoad() needs a ClassLoader parameter
Date: 16 Oct 2005 01:26:45 -0000

JDK 1.2 semantics specify that all native libraries are
associated with a single ClassLoader (see JNI spec for
details). Therefore Runtime.nativeLoad() needs an additional
ClassLoader parameter so the VM knows which one to associated
the newly loaded native library with.

Without such a parameter, the VM must "guess" but can guess
wrong, and then a JNI method will not resolve because the
native library is associated with the wrong class loader.
(yes, this actually happened to me which is why I'm reporting
the bug).

I've attached a patch to fix this, but it assumes that
the call to Runtime.load[Library]() is via System.load[Library](), which is
usually but not always
the case. Covering both cases would involve inspecting
the stack.

What we want is to identify the method that is calling
either Runtime.load*() or System.load*() and associate
the native library with the ClassLoader that loaded the
class containing that method.


------- Comment #1 from from-classpath at savannah dot gnu dot org  2005-01-12 
06:43 -------
This is now implemented. As Archie was part of the discussion when it was added
I  think he agrees then I can close this bug report.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22717





reply via email to

[Prev in Thread] Current Thread [Next in Thread]