Bug in JNI RegisterNatives?
Bryce McKinlay
mckinlay@redhat.com
Tue May 30 02:51:00 GMT 2006
Juerg Lehni wrote:
> I'm happy to write the patch but would need to know a few more things
> first.
>> Some questions:
>> - Is _Jv_LookupJNIMethod used each time a methods registered in that
> way is called, or is it only called once, and then linked directly to
> the native pointer?
It is called once, then the pointer returned is saved locally.
> - Should I create a new struct as a base for nathash, or continue to
> use JNINativeMethod and just concatenate the class name and the method
> name, seperated with a '.' and store that in the JNINativeMethod name
> field? I guess a new struct would be cleaner, as JNINativeMethod is
> also used outside jni.cc.
Sounds good.
> - What is the easiest way to retrieve the class name in UTF8 format?
> Is there something faster / easier than klass->getName() and then
> convert?
klass->name will give you the Utf8Const name. You may need to add a
friend declaration to java/lang/Class.h for this to work.
Bryce
More information about the Java
mailing list