From owner-freebsd-java Sun Oct 31 18:42:56 1999 Delivered-To: freebsd-java@freebsd.org Received: from mta01.onebox.com (mta01.onebox.com [216.33.158.208]) by hub.freebsd.org (Postfix) with ESMTP id 6B5ED15057 for ; Sun, 31 Oct 1999 18:42:52 -0800 (PST) (envelope-from onedave@onebox.com) Received: from onebox.com ([216.33.158.158]) by mta01.onebox.com (InterMail v4.01.01.07 201-229-111-110) with SMTP id <19991101024252.OIBF19933.mta01@onebox.com>; Sun, 31 Oct 1999 18:42:52 -0800 From: "dave howard" To: asudell@acm.org Cc: freebsd-java@FreeBSD.ORG Subject: Re: JNI error involving mmap Reply-To: dave howard Date: Mon, 01 Nov 1999 02:42:52 GMT Message-Id: <19991101024252.OIBF19933.mta01@onebox.com> Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org drew - thanks, that's exactly what i needed. for the record, the compiler args that worked were: > gcc -fpic -shared MyLib.c -o libMyLib.so cheers, dave. -- dave howard ---- "Andrew B. Sudell" wrote: > > I haven't had to do this in a long time (FreeBSD 2.2.7, JDK 1.0.X, old > pre-JNI native interface, a.out), but I'll try to cover the differences, > unless someone with more recent experience jumps in. > > Nate's story sounds about right, though there's not a whole lot of stuff > you need to build a shlib. First build all objects with position > independent code (-fpic in most cases or -fPIC if needed for "large > displacement branches). I'd go with -fpic, and if things don't get > better, try -fPIC, which can't hurt, only slow down function > calls. Next link the objects into a shared object. When I last did > this the the linker options was -Bshareable. A quick look at ld, > shows that is likely to still work but the man page is pushing -shared > as the preferred way. > > One thing you might try, as a way of checking your library outside of > java is to manually load it with dlopen(), and call a function or two > after resolving them with dlsym(). That's essentially what JNI is > doing under the covers. > > Drew > -- > Drew Sudell asudell@op.net http://www.op.net/~asudell __________________________________________________ FREE voicemail, email, and fax...all in one place. Sign Up Now! http://www.onebox.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message