This is the mail archive of the java-patches@gcc.gnu.org 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]

Re: patches to re-direct _Jv_RegisterClass


Tom Tromey <tromey@redhat.com> writes:

> Per> Basically, SharedLibLoader is analogous to UrlClassLoader, in
> Per> that it manages a bunch of classes that have their private name
> Per> space, but from a .so rather than a .jar.
> 
> That's cool.  Can the private namespace stuff work portably?  I mean,
> even with references to global variables and static methods?

Perhaps not "portably" - it depends on the features of dlopen
as on Unix.  I believe other Unix-like systems have the same feature.
Basically, if you *don't* specify RTLD_GLOBAL then the external
symbols form the shared library will not be made available to
subsequently shared libraries.  I.e. globals variables and static
methods have library-local visibility.  So you should be able to
load without conflict multiple libraries that export the same symbols.

It follows if foo.so depends on symbols in bar.so, then it foo.so
is to be able to resolve against the symbols in bar.so then bar.so
does have to be loaded first and *with* RTLD_GLOBAL set.  You basically
have two sensible choices for each .so:
(1) Symbols have global visibility; classes are managed by the system
ClassLoader; library either specified at link time with -l or at
runtime at dlopen *with* RTLD_GLOBAL set.
(2) Symbols are only visible with a shared library; classes are managed
by a SharedLibLoader and are only visible by going through that ClassLoader;
library linked at runtime at dlopen *without* RTLD_GLOBAL set.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/


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