深入了解JNI
1.了解JNI中JAVA类型与C/C++的映射关系
2.引用类型对照表
要具体了解某个方法或对象的签名可以使用 javap -s -private 类名;javap 更多的的参数自行查看;
关于跟多JNI的知识可以参考http://download.oracle.com/javase/6/docs/technotes/guides/jni/spec/jniTOC.html
1.了解JNI中JAVA类型与C/C++的映射关系
| JAVA类型 | 本地类型 | JNI中自定义类型 | 描述 |
| int | long | jint/jsize | signed 32 bits |
| long | _int64 | jlong | signed 64 bits |
| byte | signed char | jbyte | signed 8 bits |
| boolean | unsigned char | jboolean | unsigned 8 bits |
| char | unsigned short | jchar | unsigned 16 bits |
| short | short | jshort | signed 16 bits |
| float | float | jfloat | 32 bits |
| double | double | jdouble | 64 bits |
| void | void | void | N/A |
2.引用类型对照表
3.Type Signatures 签名
在java中很多时候会用到Overwrite等,Sign可用于表示要取得的属性或方法的类型来区分调用的属性或方法。|
TypeSignature
|
Java Type
|
|---|---|
|
Z
|
boolean
|
|
B
|
byte
|
|
C
|
char
|
|
S
|
short
|
|
I
|
int
|
|
J
|
long
|
|
F
|
float
|
|
D
|
double
|
|
L fully-qualified-class ;
|
fully-qualified-class
|
|
[ type
|
type[]
|
|
( arg-types ) ret-type
|
method type
|
要具体了解某个方法或对象的签名可以使用 javap -s -private 类名;javap 更多的的参数自行查看;
本文深入探讨了JNI中JAVA类型与C/C++类型的映射关系,并详细列举了基本类型及引用类型的对应表。同时介绍了TypeSignatures签名的概念及其在Java中的应用。

被折叠的 条评论
为什么被折叠?



