Date: Mon, 01 Nov 1999 02:42:52 GMT From: "dave howard" <onedave@onebox.com> To: asudell@acm.org Cc: freebsd-java@FreeBSD.ORG Subject: Re: JNI error involving mmap Message-ID: <19991101024252.OIBF19933.mta01@onebox.com>
next in thread | raw e-mail | index | archive | help
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" <asudell@acm.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991101024252.OIBF19933.mta01>