classpath-patches
[Top][All Lists]
Advanced

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

Re: [cp-patches] Native library class loader fixes


From: Archie Cobbs
Subject: Re: [cp-patches] Native library class loader fixes
Date: Tue, 04 Jan 2005 08:47:41 -0600
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129

Jeroen Frijters wrote:
Thanks. I implemented it with IKVM and it allowed me to remove my own
stack walking workaround in my JNI code. Everything seems to work.

I made one change to your patch (in loadLibrary in Runtime.java):
+    else
+      {
+       filename = VMRuntime.mapLibraryName(libname);
+       for (int i = 0; i < libpath.length; i++)
+         if (loadLib(libpath[i] + filename, null) != 0)
+           return;
+      }

I think the second argument to loadLib() should be "loader" instead of
null. It's a bit counterintuitive, but my understanding is that a native
library always gets associated with the class loader of the class that
called loadLibrary (regardless of whether the class loader was otherwise
involved in finding/loading the library).

You're right.. but in this "else" block it is known that loader == null,
so the effect is the same either way.

I've also attached a patch for ResourceBundle to use the new
getCallingClassLoader instead of it having it's own private hack. We
might be able to get rid of ObjectInputStream.currentClassLoader() as
well.

Great! More code rendered unnecessary :-) I'll add this to my patch.

Thanks,
-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com




reply via email to

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