Skip to main content

Posts

Showing posts with the label jni

JNI how get values updated to int and double fields

How do two values I pass into my JNI tossed down to C then C does its changes and updates the values. How do I get those two values(maxPower, index) and see then in Java? They always come back as zero. JNIEXPORT jdouble JNICALL Java_com_TV ( JNIEnv* env, jobject obj, jdouble maxPower, jint index) { jdouble result = 0; result = Feature_TV(2, &maxPower, &index ); return result; } // here is the c function it calls it actually does more than this but for // demo it should return result 60 and maxPower and index should be -5.0 and -2.. double Feature_TV(double * maxPwr, int * maxPwrIdx ) { *maxPwr = -5.0; *maxPwrIdx = -2; /// do something return 60; }