This is the mail archive of the java-discuss@sources.redhat.com 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]

gcj -fjni -> error from assember. Re: Link errors: Confused about calling C code from GCJ via jni


The -fjni  option to gcj yields an error from the assembler:
gcj -c -fjni Locfit.java
results in
/tmp/ccKRkbOa.s: Assembler messages:
/tmp/ccKRkbOa.s:1546: Error: Ignoring attempt to re-define symbol
/tmp/ccKRkbOa.s:1546: Error: Rest of line ignored. First ignored character is `,'.
Without -fjni option, the class does compile.  ('gcj -fjni Locfit.java' yields the same error message.)

Perhaps I need to back up to an older build - I'm using Gcc Version 2.97 20010112 (Experimental),
which was current as of Friday.  Does anyone know of a builld where the -fjni is working?

Regards and thanks,

Barnet

PS This is probably already on someone's todo list: gcj -help is a bit out of date and doesn't list the -fjni option
 

Tom Tromey wrote:

>>>>> "Barnet" == Barnet Wagman <wagman@enteract.com> writes:

Barnet> The header generated by gcjh looks like C to me, but when I
Barnet> try to link this library against gcj compiled java, it looks
Barnet> as if gcj is looking for C++.

It is.

If you have a Java class with native methods written using JNI and not
CNI, then you have to compile that class using `-fjni'.  This will
cause gcj to generate the appropriate stubs for making JNI calls.

This won't work if you are using gcj 2.95, because JNI was not
implemented until after that release.

This is one of many topics that will be addressed by the
documentation.

Tom


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