I got a problem in calling Java method in C++ using JNI. The method returns const char* which in Java is String.
For now I use methodInfo.env~~>CallStaticCharMethod;
But, the return result is not as expected .
if I change into CallStaticStringMethod, it returns error when compilation.
Can anyone show the correct form of method that returns const char* or String ?
Below is my JNI code, hope someone can notice the mistake and make a correction to it.
Thanks a lot guys.
const char* getNameJNI{
JniMethodInfo methodInfo;
jstring ret;
if Ljava/lang/String;")){
return ret;
}
ret = methodInfo.env~~>CallStaticCharMethod(methodInfo.classID, methodInfo.methodID);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
return (const char*)ret;
}