From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 646 invoked by alias); 12 Apr 2014 09:37:34 -0000 Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org Received: (qmail 631 invoked by uid 89); 12 Apr 2014 09:37:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=BAYES_20,FREEMAIL_FROM,SPF_NEUTRAL autolearn=no version=3.3.2 X-HELO: fred.zcu.cz Received: from fred.zcu.cz (HELO fred.zcu.cz) (147.228.57.19) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 12 Apr 2014 09:37:31 +0000 Received: from [192.168.2.50] (unknown [95.173.83.20]) (Authenticated sender: knezik) by fred.zcu.cz (Postfix) with ESMTPSA id 705F0300C6341 for ; Sat, 12 Apr 2014 11:37:23 +0200 (CEST) Message-ID: <5349091B.9080006@email.cz> Date: Sat, 12 Apr 2014 09:37:00 -0000 From: Jan Knezik User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: java@gcc.gnu.org Subject: Using libraries - CNI and JNI Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-ZCU-MailScanner-ID: 705F0300C6341.AD84A X-ZCU-MailScanner: Found to be clean X-ZCU-MailScanner-SpamCheck: not spam, BRBL, SpamAssassin (not cached, score=-22.889, required 5, autolearn=not spam, ALL_TRUSTED -1.00, AUTHENTICATED -20.00, BAYES_00 -1.90, FREEMAIL_FROM 0.00, T_TO_NO_BRKTS_FREEMAIL 0.01) X-ZCU-MailScanner-From: jan.kn@email.cz X-SW-Source: 2014-04/txt/msg00000.txt.bz2 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