This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
shared libraries
- To: java at gcc dot gnu dot org
- Subject: shared libraries
- From: Anthony Green <green at redhat dot com>
- Date: Sun, 16 Sep 2001 18:26:34 -0700
- Reply-to: green at cygnus dot com
I've noticed an annoying problem while working with shared libraries
and Class.forName().
If the class loader finds the proper .so, Class.forName() may still
throw a ClassNotFoundException if that .so hasn't been linked with
every .so it depends on at runtime (unless those libraries have
already been loaded, libgcj.so).
The linker certainly doesn't complain about this at link time, and
there doesn't appear to be any convenient way to figure out the
dependencies. I've been reduced to tricks like...
$ LD_PRELOAD=lib-Foo.so ls
ls: error while loading shared libraries: /home/green/lib/lib-Foo.so: undefined symbol: _ZN3Bar3bar6class$E
This tells me I have to link the .so containing Bar.bar when I create
lib-Foo.so or else `Class.forName("Foo.foo")' will fail.
Is there any easier way to deal with this?
AG