Shared LIbraries Registering classes
Tom Tromey
tromey@redhat.com
Tue Jul 8 04:35:00 GMT 2003
>>>>> "Steve" == Steve Pribyl <steve@netfuel.com> writes:
Steve> I am working on getting SharedLibLoader to work and have some
Steve> questions about it.
Note that there's a still-pending patch from a while back (February or
so) that changes this class' implementation a bit. Chances are it
will go in in the relatively near future, at least barring outcry or
objection.
With this patch you can continue to use SharedLibLoader, but you can
also instead just add an "solib:" URL to your class path. The latter
is (imho) much simpler...
I considered just removing SharedLibLoader entirely, on the theory
that with the null-termination bug, it probably wasn't in use anyway.
However, the aforementioned patch doesn't do that.
Steve> What causes shared libraries to register classes? Does an _init
Steve> function need to be written?
Steve> How about non-shared libraries?
There is some special magic that causes classes to be registered when
a .so is loaded. There is a special section that the loader handles.
See gcc/crtstuff.c; search for "_Jv_RegisterClasses".
I don't know exactly what happens with non-shared libraries. I
imagine that same code arranges for the classes that are linked in to
be registered before main().
Steve> Does the SharedLibLoader code actually work?
I think so, except for the bugs you've found.
There might be more bugs. I'm not too sure about that; my work in
this area has all been with the solib: URL patch, with
SharedLibLoader work in the form of "keeping it the same".
Tom
More information about the Java
mailing list