From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25529 invoked by alias); 4 May 2009 06:45:09 -0000 Received: (qmail 25514 invoked by uid 22791); 4 May 2009 06:45:07 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_54,J_CHICKENPOX_55,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from wf-out-1314.google.com (HELO wf-out-1314.google.com) (209.85.200.168) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 04 May 2009 06:45:02 +0000 Received: by wf-out-1314.google.com with SMTP id 25so2618824wfc.14 for ; Sun, 03 May 2009 23:45:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.231.7 with SMTP id d7mr1954802wfh.285.1241419500394; Sun, 03 May 2009 23:45:00 -0700 (PDT) Date: Mon, 04 May 2009 06:45:00 -0000 Message-ID: <898285d30905032345x4272dcf5me3dfd8026269b9d5@mail.gmail.com> Subject: linking to jni code From: abhishek desai To: java@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2009-05/txt/msg00000.txt.bz2 Hi, I am using the below command to compile a java program making calls to native functions implemented using JNI. gcj --main=MyApp -fjni MyApp.class MyApp.o -o MyApp Here MyApp.class is the class file generated from MyApp.java MyApp.o is the object file generated from MyApp.c implementing the JNI calls InitBase and PrintString. The command generated the executable but when executing it gives the following error. Exception in thread "main" java.lang.UnsatisfiedLinkError: InitBase at EpgApp.InitBase(MyApp) at EpgApp.main(MyApp) Looks like the MyApp.o file does not get linked into the application. Is there a way to get it linked into the Application statically?