This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Linking C, Fortran to be Called by Java
- From: bjorn rohde jensen <shamus at tdcadsl dot dk>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 22 May 2002 23:22:46 +0200
- Subject: Re: Linking C, Fortran to be Called by Java
- References: <OKELKEGKKOINCPCMEJFIOEDHCMAA.astone@brightlane.com>
- Reply-to: shamus at tdcadsl dot dk
Hi Andrew,
Pretty cool project:) I dont know much about Solaris or JNI,
but i think, you might be missing a few linker options. I think,
shared objects ougth to be position independent code, relocatable
code or whatever, it is called. That should make it easier for the
runtime linker to do its work, you should be able to find docu on
that sort of thing. On linux this is done with the compiler option
-fPIC.
> gcc -o libjniCheck.so -I/usr/java/include -I/usr/java/include/solaris
> jniCheck.cpp CALCULATE.o -lg2c -lm
Is that the exact line? If it is, then, i would say, you are creating
an executable by the name of libjniCheck.so not a shared object. To
build a shared object, you should give gcc the -shared option during
link stage.
I have no idea, what that error is all about, but trying to load
an executable as a shared object should certainly fail, maybe that is
the reason?
Yours sincerely,
Bjorn