Compiling of GCJ and SWT under MacOS X

Andi Vajda andi@osafoundation.org
Thu Feb 10 02:31:00 GMT 2005


> In theory JNI is both source- and binary- compatible across
> implementations. Do you know of some specific divergence here?
> This really ought to work fine... it does on other platforms.

In practice though, here are some differences, for example:
 - on Mac OS X, sizeof(JNINativeInterface) returns 928 with gcj's jni.h but
 sizeof(JNINativeInterface_) returns 1828 when compiled against OS X's
 JDK 1.4.2 jni.h. If even you remove the 228 real_functions at the end of
 the OS X definitions, you're left with 928 vs 916.
 - similarly, JNINativeInterface is 32 long with gcj's jni.h and 48 long with
 OS X's JDK jni.h and there the extra 16 bytes seem to come from addition in
 the middle of the structure.
 - on Windows, Mingw gcj's jni doesn't use __stdcall for JNICALL, so there is
 calling convention mismatch when linking against non-mingw-gcj-recompiled
 JNI libs there
I discovered this while trying to use Berkeley DB's libdb_java JNI lib. It is 
not until I changed its build to compile against gcj's jni.h that I go it to
work.
Andi..


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /