JNI学习系列——深入了解JNI

来源:互联网 发布:ios 大型游戏源码 编辑:程序博客网 时间:2024/05/29 19:42

转自:

http://blog.csdn.net/y13872888163/article/details/6598398

深入了解JNI

  1.了解JNI中JAVA类型与C/C++的映射关系
JAVA类型
本地类型
JNI中自定义类型
描述
int
long
jint/jsize
signed 32 bitslong
_int64
jlong
signed 64 bitsbyte
signed char
jbyte
signed 8 bitsboolean
unsigned char
jboolean
unsigned 8 bitschar
unsigned short
jchar
unsigned 16 bitsshort
short
jshort
signed 16 bitsfloat
float
jfloat
32 bitsdouble
double
jdouble
64 bitsvoid
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的知识可以参考http://download.oracle.com/javase/6/docs/technotes/guides/jni/spec/jniTOC.html