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?
> 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)
This is of course trivial - but maybe some will benefit from having it
here now... :o)
However, doing so with my gcj (3.3.1 (cygming special)) under cygwin
will result in the following error:
collect2: ld terminated with signal 11 [Segmentation fault], core dumped
/cygdrive/c/src/lib/MYLIB.so(.text+0x0):crtstuff.c: multiple definition
of `___do_sjlj_init'
/bin/../lib/gcc-lib/i686-pc-cygwin/3.3.1/crtbegin.o(.text+0x0):crtstuff.c:
first defined here
But compiling and linking with my (cross)gcj-3.4.0 works fine...
Regards,
Martin