views:

26

answers:

1

For example, there are two different JNI methods of the SAME object


class JavaObj{
   public native void methodA();
   public native void methodB();
}

The JNI headers for these methods could be


JNIEXPORT void JNICALL Java_JavaObj_methodA(JNIEnv * pEnv, jobject javaobj);
JNIEXPORT void JNICALL Java_JavaObj_methodB(JNIEnv * pEnv, jobject javaobj);

So is it safe to assume that the values of pEnv and javaobj are the SAME in these two seperate JNI calls?

+1  A: 

Of course not. The JNIEnv * can change any time between JNI calls, and you can have multiple instances of your class.

EJP