Bug in JNI RegisterNatives?

Tom Tromey tromey@redhat.com
Wed May 31 12:24:00 GMT 2006


>>>>> "Juerg" == Juerg Lehni <juerg@scratchdisk.com> writes:

Juerg> I just tried to do this but was running into troubles with needed  
Juerg> forward declarations in Class.h for JNIEnv and JNINativeMethod, both  
Juerg> needed to declare _Jv_JNI_RegisterNatives as a friend.

Juerg> The way these are defined in jni.h, it seems to not be possible to  
Juerg> forward declare them in Class.h. A possible solution is to include  
Juerg> jni.h there, but before I go ahead I'd like to hear your opinion on  
Juerg> this.

You shouldn't need to.  You can just declare them like:

    struct JNIEnv;
    struct JNINativeMethod;

in Class.h.

In fact, JNIEnv must already be handled this way, since it is already
referred to in Class.h.

Tom



More information about the Java mailing list