This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Creating "semi"-shared gcj objects for other gcj applications?
Martin Egholm Nielsen writes:
> > > This question is somewhat related to Sal's question back in May
> > > (http://gcc.gnu.org/ml/java/2004-05/msg00143.html).
> > > However, I just want to make shared objects for use with other gcj
> > > applications.
> > It's all in the docs.
> > * When you compile your classes into a shared library they can be
> > automatically loaded by the `libgcj' system classloader.
> Ok, thanks... I managed to get it to work using the simple commands:
>
> $ gcj -c MYLIB.java (creates MYLIB.o)
> $ gcj -shared -o MYLIB.so MYLIB.o (creates the shared object MYLIB.so)
> $ gcj -c MyApplication.java (creates MyApplication.o)
> $ gcj --main=MyApplication MyApplication.o MYLIB.so (links MyApplication
> with MYLIB.so)
No. :-)
Try
gcj -c -fPIC MYLIB.java
gcj -shared -o libMYLIB.so MYLIB.o
gcj --main=MyApplication MyApplication.o -L. -lMYLIB
Andrew.