Monday, 15 August 2011

java - Comparing JNI object references -



java - Comparing JNI object references -

i phone call java method c++ via jni. java method returns enum status. have jobjects representing enums in c++ code here: http://stackoverflow.com/a/17441151/3352197

jclass clstatus = env->findclass("myclass$status"); jfieldid fidone = env->getstaticfieldid(clstatus , "one", "lmyclass$status;"); jobject status_one = env->getstaticobjectfield(clstatus, fidone);

so, call

jobject o = env->callobjectmethod(jtestobject, test);

returns jobject representing enum status, specially one. so, how know enum has returned? tried compare status_one, not match.

found myself, after samhain pointed out possible mistake. have compare objects correctly:

env->issameobject(o, status_one);

thank you!

java c++ jni

No comments:

Post a Comment