public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/30673] New: [jni] Different behaviour than a Sun JRE
@ 2007-02-01 21:32 mtrudel at gmx dot ch
0 siblings, 0 replies; only message in thread
From: mtrudel at gmx dot ch @ 2007-02-01 21:32 UTC (permalink / raw)
To: java-prs
A JNI problem where GCJ isn't doing the same as a Sun JDK:
public class NativeBooleanTest
{
public static void main(String[] args)
{
System.loadLibrary("nativeBoolean");
nativePrintBoolean(false);
nativePrintBoolean(true);
nativePrintBooleanAsInt(false);
nativePrintBooleanAsInt(true);
}
private static native void nativePrintBoolean(boolean b);
private static native void nativePrintBooleanAsInt(boolean b);
}
C code:
#include <jni.h>
JNIEXPORT void JNICALL Java_NativeBooleanTest_nativePrintBoolean
(JNIEnv *env, jclass c, jboolean b)
{
printf("nativePrintBoolean: %d\n", b);
}
JNIEXPORT void JNICALL Java_NativeBooleanTest_nativePrintBooleanAsInt
(JNIEnv *env, jclass c, jint b)
{
printf("nativePrintBooleanAsInt: %d\n", b);
}
On a sun JVM, the output will be:
nativePrintBoolean: 0
nativePrintBoolean: 1
nativePrintBooleanAsInt: 0
nativePrintBooleanAsInt: 1
GCJ will print something like:
nativePrintBoolean: 0
nativePrintBoolean: 1
nativePrintBooleanAsInt: 10084864
nativePrintBooleanAsInt: 10084865
--
Summary: [jni] Different behaviour than a Sun JRE
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mtrudel at gmx dot ch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30673
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-02-01 21:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-01 21:32 [Bug java/30673] New: [jni] Different behaviour than a Sun JRE mtrudel at gmx dot ch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).