JNI中将java字符串传给C语言 中的一个NULL问题

来源:互联网 发布:局域网语音对讲软件 编辑:程序博客网 时间:2024/06/11 05:05

参考链接:http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/design.html#wp16696 【给出了清楚的例子(*env)->GetStringUTFChars(env, s, 0);

如果,JNI的代码中用到NULL时,可能会报错:NULL undeclared in this function.

解决方案参照了链接:http://stackoverflow.com/questions/30163736/null-undeclared-first-use-in-this-function-using-android-ndk/30212227#30212227

其实,解决方法,很简单。

NULL未申明,只需要加入一个头文件:

#include "stddef.h"
然后重新运行就好。

0 0