JNI 如何存储字符数组并将其记录在jNI中?
我正在将 char[] 从 java 发送到 C 。我想存储我的 methodid 函数的返回值:
mid = (*env)->GetMethodID(env, clazz, "getReg_chal", "()[C");
char[] reg_chal = (*env)-> ?
我将以下示例作为参考:
jmethodID midGetName = (*env)->GetMethodID(env, employeeClass, "getAge", "()I");
int age = (*env)->CallIntMethod(env, employeeObject, midGetName);
return age;
我将写什么? ...因为 CallCharArrayMethod 在 JNI 中不可用。
提前致谢..
I'm sending char[] from java to C .I want to store the return value of my methodid function :
mid = (*env)->GetMethodID(env, clazz, "getReg_chal", "()[C");
char[] reg_chal = (*env)-> ?
I'm referring the following example as refrence:
jmethodID midGetName = (*env)->GetMethodID(env, employeeClass, "getAge", "()I");
int age = (*env)->CallIntMethod(env, employeeObject, midGetName);
return age;
What will i write in ? ... since CallCharArrayMethod is not available in JNI.
Thanks in advance..
CallObjectMethod() 就可以了。请参阅http://www.velocityreviews.com/ forums/t140355-jni-calling-methods-that-return-byte.html 和 http://download.oracle.com/javase /1.5.0/docs/guide/jni/spec/functions.html#wp16656
CallObjectMethod() would be work. see http://www.velocityreviews.com/forums/t140355-jni-calling-methods-that-return-byte.html and http://download.oracle.com/javase/1.5.0/docs/guide/jni/spec/functions.html#wp16656