[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Example on JNI compilation

From: John Calcote
Subject: Re: Example on JNI compilation
Date: Mon, 20 Apr 2009 16:54:07 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b3pre) Gecko/20090223 Thunderbird/3.0b2

On 4/20/2009 3:49 PM, Peter O'Gorman wrote:
John Calcote wrote:
On 4/18/2009 3:08 PM, LCID Fire wrote:
I'm currently stuck with compiling a JNI library, which java does not
recognize. I'm not too sure about what options I have to provide to
automake and which are already builtin. Does anybody know an example
of how a jni lib is built using automake?
There are basically two steps to building JNI libraries:

Note that on Mac OS X 10.4 and earlier, java will not load modules that
do not have a ".jnilib" extension, so you should add somewhere in, something like:

case $host_os in
    JNI_EXTRA_LDFLAGS="-shrext .jnilib" ;;

then in your you can have:
mylib_la_LDFLAGS = -module -avoid-version $(JNI_EXTRA_LDFLAGS)

Thanks Peter, I didn't know this. I guess it won't be long before this isn't really an issue for newer macs, as 10.6 will probably be released in June, thereby bringing 10.4 to end-of-life state. However, there will still be plenty of older mac users out there.

I might as well ask this question here: We build a regular C/C++ shared library, and link our JNI stubs right into it, exporting the JNI interfaces right along side the native library interfaces. It seems to work well on the platforms we've tried it out on, and it saves a library. In fact, we do the same thing with our C# (mono) interfaces, so this library has a hefty exported API.

Besides the issue you pointed out above where JNI libs require a specific extension, do you know of any other issues with doing this sort of thing?

Thanks in advance,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]