This is the mail archive of the java@gcc.gnu.org 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]
Other format: [Raw text]

Re: Error calling method from a shared object


>>>>> "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


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