Creating "semi"-shared gcj objects for other gcj applications?

Martin Egholm Nielsen martin@egholm-nielsen.dk
Wed Jun 9 08:09:00 GMT 2004


Hi Andrew,

 >>>>> 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.  :-)
Huum! (o:

 >> Try
 >> gcj -c -fPIC MYLIB.java
 >> gcj -shared -o libMYLIB.so MYLIB.o
 >> gcj --main=MyApplication MyApplication.o -L. -lMYLIB
Well, the output seems identical, nevertheless. Though, specifying the 
PIC-option made the stripped version of the shared object smaller. Any 
explanation?

 > Oh Lord, this is Cygwin, isn't it?  I'm sorry, I know nothing about
 > Cygwin.  This would work on Linux...  :-)
Hey, who said anything about cygwin?! (Although you're right (o:)

But I still get the "MYLIB.so(.text+0x0):crtstuff.c: multiple definition 
of `___do_sjlj_init'" error whether doing it your way or not.
I think I'll just try gcc 3.4, and see if it works there...

Regards,
  Martin




More information about the Java mailing list