public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Knezik <jan.kn@email.cz>
To: java@gcc.gnu.org
Subject: Using libraries - CNI and JNI
Date: Sat, 12 Apr 2014 09:37:00 -0000	[thread overview]
Message-ID: <5349091B.9080006@email.cz> (raw)

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

             reply	other threads:[~2014-04-12  9:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-12  9:37 Jan Knezik [this message]
2014-04-12 17:46 ` Bryce McKinlay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5349091B.9080006@email.cz \
    --to=jan.kn@email.cz \
    --cc=java@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).