Error calling method from a shared object

Tom Tromey tromey@redhat.com
Wed Feb 5 18:46:00 GMT 2003


>>>>> "Ashish" == Ashish Srivastava <ashish7s@yahoo.com> writes:

Ashish> public class A {
Ashish>   public prnt() {
Ashish>      System.out.println("Hello World");

This is a non-static method, so you must call it with an object
reference.

Ashish> Compiled it with gcj and linked libgcj.so and
Ashish> libiconv.so and created a shared object libA.so. Again
Ashish> wrote a short 'C' program :
Ashish> main() {
Ashish>    _Zx726xkjad();
Ashish> }

Haven't seen that before!  This won't work.  libgcj is not just an
ordinary library; it requires a certain amount of setup.

Instead I suggest you do one of these things:

* Write a `main' method in java (see Java documentation and also the
  gcj manual)
* Use the CNI invocation interface (gcj manual)
* Use the JNI invocation interface (JNI manual or book)

Tom



More information about the Java mailing list