Bug in JNI RegisterNatives?

Juerg Lehni juerg@scratchdisk.com
Wed May 31 12:35:00 GMT 2006


That's what I tried.
But the way JNINativeMethod is defined in jni.h, I cannot forward 
declare it that way. Here's the relevant part from jni.h:
typedef struct
{
	...
} JNINativeMethod;
Changing this would help, but I'm not sure we can do this, as the 
file is part of classpath. But this should work:
typedef struct JNINativeMethod
{
	...
} JNINativeMethod;
Class.h does not foward declare JNIEnv. _Jv_JNIEnv is used at 4 
places, but not declared. I'm a bit puzzled. It must be declared in 
one of the includes, but where?
Jürg
Am 31.05.2006 um 14:20 schrieb Tom Tromey:
>>>>>> "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

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