From owner-freebsd-java Fri Dec 31 18:27: 7 1999 Delivered-To: freebsd-java@freebsd.org Received: from fnal.fnal.gov (fnal.fnal.gov [131.225.9.8]) by hub.freebsd.org (Postfix) with ESMTP id 9E9F014E8A for ; Fri, 31 Dec 1999 18:27:05 -0800 (PST) (envelope-from tez@nova.fnal.gov) Received: from nova.fnal.gov ([131.225.18.207]) by FNAL.FNAL.GOV (PMDF V5.2-32 #36665) with ESMTP id <01JK5XG0PCXS0009AU@FNAL.FNAL.GOV> for freebsd-java@FreeBSD.ORG; Fri, 31 Dec 1999 20:27:02 -0600 CDT Received: from localhost (tez@localhost) by nova.fnal.gov (8.9.1b+Sun/8.9.1) with ESMTP id UAA12362; Fri, 31 Dec 1999 20:27:00 -0600 (CST) Date: Fri, 31 Dec 1999 20:27:00 -0600 (CST) From: Tim Zingelman Subject: Re: java JNI compile problems In-reply-to: <386D454B.694B5093@1connect.com> To: Keith Wong Cc: freebsd-java@FreeBSD.ORG Reply-To: Tim Zingelman Message-id: MIME-version: 1.0 Content-type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Keywords: java JNI gcc compile build shared undefined main lib library To build a shared library you will want to use -fpic & -shared % gcc -fpic -shared -g -I/usr/local/jdk1.1.8/include/ -I/usr/local/jdk1.1.8/include/freebsd HelloWorldImp.c -o libhello.so The -g just adds debug info... -fpic makes it position independent and -shared makes it a shared library. Also if you are running an older (non-ELF) machine, you will need to add the -aout flag to build compatible libraries. - Tim On Fri, 31 Dec 1999, Keith Wong wrote: > Hi All, > I want to use the java JNI to integrated with C. And, i tried to follow > the example at the java.sun's website. then I get the problem when I > try to compile the shared the library using gcc -g, then i get the > error. > Keith > > % gcc -g -I/usr/local/jdk1.1.8/include/ > -I/usr/local/jdk1.1.8/include/freebsd HelloWorldImp.c > -o libhello.so > /usr/lib/crt1.o: In function `_start': > /usr/lib/crt1.o(.text+0x69): undefined reference to `main' To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message