Using libraries - CNI and JNI

Jan Knezik <[email protected]> Sat, 12 Apr 2014 11:36:27 +0200
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
Hello guys,
I have some questions about GCJ:

1. Is it possible to compile and get work together main programme and 
.so library (both written in Java) with GCJ using CNI or JNI?

2. I have the following code:

public class Test {
     static {
         System.loadLibrary("Test");
     }

     public native void hello();

     public static void main(String[] args) {
         new Test().hello();
     }
}

I tried to compile it with "gcj Test.java --main=Test -o Test.bin". I got:

/tmp/ccWZkOjd.o:(.data+0x50): undefined reference to `hidden alias for 
void Test::hello()'
/tmp/ccWZkOjd.o:(.data+0xc8): undefined reference to `hidden alias for 
void Test::hello()'

I did not use "-fjni" so CNI should have been set. Where is the problem, 
please? Thank you.

Jan Knezik