Superpowered Ndk Android: Returning Int Succeeds In "extern" Block, Fails In Called Function
I'm trying to figure out how to return an int to Java from a C++ function. On the Java side, I have the following in a button. I put it in a button to ensure that the app was compl
Solution 1:
You call returnInt()
before SuperpoweredExample()
. Therefore you are dereferencing a NULL pointer, example
.
Also you didn't return anything from the function declared as returning jint
You need:
extern"C"JNIEXPORT jint Java_com_superpowered_crossexample_MainActivity_returnInt(JNIEnv * __unused javaEnvironment, jobject __unused obj){
return example->returnInt();
}
Post a Comment for "Superpowered Ndk Android: Returning Int Succeeds In "extern" Block, Fails In Called Function"