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]

Re: Dynamically loaded modules


>>>>> "David" == David Marceau <dmarceau@8d.com> writes:

David> I have libsampNat.so which contains an CNI-based servic(not
David> JNI) that I compiled with gcj -shared.

David> How do I run gij in order to have sample.class
David> loadLibrary("sampNat") like the jni example gets loaded up in
David> the gcj/JNI example in the gcj faq.

I'm not sure I really understand your question.

If you have some class which invokes loadLibrary then that should just
work.

If you want the loading to happen invisibly (eg, via Class.forName)
then you have to rename your library.

In libgcj, the system classloader looks for classes in shared
libraries.  For a class named `pkg.foo.bar', it will first look for
`pkg-foo-bar.so', then `pkg-foo.so', and finally `pkg.so'.

So for instance suppose you are using the `my.service' package and you
have a class `my.service.Start' with a method `main'.

Then you could make `my-service.so' and invoke:

    gij my.service.Start ... arguments ...

This would magically load my-service.so and invoke Start.main with the
arguments.

Does that answer your question?

Tom


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