This is the mail archive of the java@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]

shared libraries



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


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