I am able to call some C code from Java via JNI.
Is it possible to compile Java with gcj and call the same
C code directly ? What needs to be done ?
DG
puzzlecracker - 29 Sep 2005 03:13 GMT
> I am able to call some C code from Java via JNI.
>
> Is it possible to compile Java with gcj and call the same
> C code directly ? What needs to be done ?
>
> DG
sure...
Roedy Green - 29 Sep 2005 05:00 GMT
>Is it possible to compile Java with gcj and call the same
>C code directly ? What needs to be done ?
I don't think so. The JNI interface would remain the same. It is not
as though native compilation works by turning Java into C first.
You could do a quick experiment to see if GCJ in expecting a JNI
interface for native methods. There are several native classes
available to download on my website.
I suggest
http://mindprod.com/products1.html#PENTIUM
http://mindprod.com/products1.html#FILETIMES
http://mindprod.com/products1.html#MOUSE
http://mindprod.com/products1.html#SETCLOCK is probably a bit too
complicated.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
Roedy Green - 29 Sep 2005 06:57 GMT
>http://mindprod.com/products1.html#PENTIUM
this one would be easiest to port to Linux. It does no system calls.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
David N. Welton - 29 Sep 2005 08:27 GMT
> I am able to call some C code from Java via JNI.
>
> Is it possible to compile Java with gcj and call the same
> C code directly ? What needs to be done ?
If you are only interested in targeting gcj, you might also look at CNI:
http://gcc.gnu.org/onlinedocs/gcj/About-CNI.html
Ciao,

Signature
David N. Welton
- http://www.dedasys.com/davidw/
Linux, Open Source Consulting
- http://www.dedasys.com/