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
Bjorn,
Thank you for your help. I had come across that compiler option (-fPIC),
but did not
know it's true effect. Very good point with the -shared option. After
being somewhat
overwhelmed with the compiler options I had come across, I forgot to go back
that.
I won't have the time to test again till tomorrow, but I'll let you know how
it turned out.
again, thanks for the help,
andy
----- Original Message -----
From: "bjorn rohde jensen" <shamus@tdcadsl.dk>
Cc: <gcc-help@gcc.gnu.org>
Sent: Wednesday, May 22, 2002 5:22 PM
Subject: Re: Linking C, Fortran to be Called by Java
> 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