Saturday, April 20, 2013

jni jnienv IsSameObject example c c++ java


IsSameObject


jboolean IsSameObject(JNIEnv *env, jobject ref1, jobject ref2);

Tests whether two references refer to the same Java object.
LINKAGE:
Index 24 in the JNIEnv interface function table.
PARAMETERS of IsSameObject

env: the JNI interface pointer.

ref1: a Java object.

ref2: a Java object.

RETURNS:

Returns JNI_TRUE if ref1 and ref2 refer to the same Java object, or are both NULL; otherwise, returns JNI_FALSE.
Example of IsSameObject
{
jobject o = env->NewLocalRef(jobj);
if ( !env->IsSameObject(o,NULL))
{
....
}
}