Subject: Re: Mixing NetBSD and Linux shared libs
To: Paulo Alexandre Pinto Pires <>
From: Todd Vierling <>
List: current-users
Date: 04/18/2002 16:44:08
On Thu, 18 Apr 2002, Paulo Alexandre Pinto Pires wrote:

: Surprisingly (to me, at least), the JNI examples from Sun's
: documentation worked fine with NetBSD native shared libs (since I don't
: have Linux development tools handy at home), even though the JVM is a
: Linux program.  Can I expect more complex shared objects to also work?

Are the JNI examples simply calling back into the JVM to do their "hello
world" type operations?  If so, you're simply compiling against the JNI API,
which would result in compatible shared objects on i386 (only out of luck,
because NetBSD and Linux share the ELF file format and calling conventions).

Calling libc functions, or any other function outside of the scope of the
fixed JNI API (which is usually the point of JNI in the first place :)
typically will not work without actually using Linux includes and libraries
(and typically, compiler, since the crtbegin/crtend files are different).

You may have had some *luck* with, say, read(), write(), and malloc()
because these functions are the same ABI (binary interface) on NetBSD and
Linux, but you'll find that they diverge pretty quickly beyond that.  Don't
expect to be able to use the NetBSD includes and libs to create any more
complex JNI modules.

-- Todd Vierling <>  *  Wasabi & NetBSD:  Run with it.
-- CDs, Integration, Embedding, Support --