How the "library naming scheme" works loading dynamical libraries?
Martin Egholm Nielsen
martin@egholm-nielsen.dk
Tue Dec 13 19:37:00 GMT 2005
Hi,
I just stumbled across:
http://gcc.gnu.org/ml/java/2002-11/msg00394.html
searching for how to implement and use gcj-natively-compiled shared
libraries loaded dynamically (R).
In short, this posting's example loads an implementation (named "bte")
of an interface (named "bi") dynamically at runtime using
"Class.forName("bte")" and having LD_LIBRARY_PATH pointing to the path
of the shared library.
Fine! However, I'm not quite familiar with the mechanism that tracks
down the implementation, "bte", located in the library "lib-bte.so".
Does the class loader search each and every library in LD_LIBRARY_PATH
for this implementation? In it does, when does it do - at gcj init-time
or at Class.forName() invocation-time?
In case the library to "search" is determined by the argument to
Class.forName(), how does one create and use a shared library with more
than just one "implementation"?
BR,
Martin Egholm
More information about the Java
mailing list