classpath
[Top][All Lists]
Advanced

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

Re: Patch: jni.h


From: Dalibor Topic
Subject: Re: Patch: jni.h
Date: Wed, 28 Apr 2004 18:02:29 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7b) Gecko/20040316

David Holmes wrote:
GetStringUTFChars returns "const char *" which is much
more logical and seems to be the right thing. JNI 1.1 spec says it
should return "const jbyte *". I search a little bit with google and
jni.h in other open source projects use "const char *" too. Now I
really wonder what we should do ? Should we leave it like it is and
cast to "const char *" in all instances we use GetStringUTFChars in out
own code or should we just apply the attached patch to change our
jni.h.


Sun's own jni.h uses "const char*"

This may be a typo in the JNI 1.1 spec as the corresponding
ReleaseStringUTFChars takes a "const char*" too.

The Java Native Interface Programmer's Guide and Specification
uses jbyte* in $3.2.1 example http://java.sun.com/docs/books/jni/html/objtypes.html . The latest JNI docs from 1.4.2 also use jbyte :
http://java.sun.com/j2se/1.4.2/docs/guide/jni/spec/functions.html#wp17265
The JNI tutorial uses a const char * in its example here
http://java.sun.com/docs/books/tutorial/native1.1/implementing/string.html

Given that jbyte is signed 8 bits and a char can be signed or unsigned (and doesn't have to be 8 bits), I'm not quite sure what the implications of a change in the prototype are.

cheers,
dalibor topic




reply via email to

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