JNI
来源:互联网 发布:log4j.xml 配置 sql 编辑:程序博客网 时间:2024/06/08 10:38
--------------------类型映射(the mapping of types between Java and native code)
英文版:
http://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/types.html
or
docs/technotes/guides/jni/spec/types.html
中文版:
The following definition is provided for convenience.
#define JNI_FALSE 0#define JNI_TRUE 1
The jsize
integer type is used to describe cardinal indices and sizes:
typedef jint jsize;
In C, all other JNI reference types are defined to be the same as jobject. For example:
typedef jobject jclass;
In C++, JNI introduces a set of dummy classes to enforce the subtyping relationship. For example:
class _jobject {};class _jclass : public _jobject {};...typedef _jobject *jobject;typedef _jclass *jclass;
--------------------类型签名(Type Signatures)
long f (int n, String s, int[] arr);
has the following type signature:
(ILjava/lang/String;[I)J
说明:
1." fully-qualified-class" :完全限定类,如java.lang.String
2." Ljava/lang/String;":java/lang/String
3. "[I ":int[]
签名:
签名是一种用参数个数和类型区分同名方法的手段,即解决方法重载问题。
其中要特别注意的是:
1. 类描述符开头的'L'与结尾的';'必须要有
2. 数组描述符,开头的'['必须有
3. 方法描述符规则: "(各参数描述符)返回值描述符",其中参数描述符间没有任何分隔符号
描述符很重要,请烂熟于心. 写JNI,对于错误的签名一定要特别敏感,此时编译器帮不上忙,执行make前仔细检查你的代码。
【参考资料】
jni详解,http://wenku.baidu.com/view/a06ff70d6c85ec3a87c2c55a.html
http://www.blogjava.net/china-qd/archive/2006/04/29/44002.html
- Jni
- JNI
- JNI
- JNI
- JNI
- JNI
- JNI
- JNI
- JNI
- JNI
- JNI
- JNI
- JNI
- JNI
- JNI
- JNI
- JNI
- JNI
- 非专业人士观点(4)知道什么样算好
- Android获取其他包的Context实例,然后调用它的方法
- 并查集(Union-Find Sets)及其应用
- OpenGL编程指南第六章:混合、反锯齿、雾、多边形偏移
- 如何配置Apache 防止图片盗链
- JNI
- AbstractAction类
- XenServer 执行xe pbd-plug 产生 SR_BACKEND_FAILURE_90错误解决方案
- linux内核initrd文件自定义方法
- JAVA多线程学习笔记—1
- 缓存系统MemCached的Java客户端优化历程
- 九九乘法表(java)
- OpenNebula 3.6 新功能介绍
- QTP---描述性编程