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]
Other format: [Raw text]

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.


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