JAVA C 数据类型对应
{
Java—C和操作系统数据类型的对应表
Java Type |
C Type |
Native Representation |
boolean |
int |
32-bit integer (customizable) |
byte |
char |
8-bit integer |
char |
wchar_t |
platform-dependent |
short |
short |
16-bit integer |
int |
int |
32-bit integer |
long |
long long, __int64 |
64-bit integer |
float |
float |
32-bit floating point |
double |
double |
64-bit floating point |
pointer |
platform-dependent (32- or 64-bit pointer to memory) |
|
<T>[] (array of primitive type) |
pointer |
32- or 64-bit pointer to memory (argument/return) |
除了上面的类型,JNA还支持常见的数据类型的映射。 |
||
char* |
NUL-terminated array (native encoding or |
|
wchar_t* |
NUL-terminated array (unicode) |
|
char** |
NULL-terminated array of C strings |
|
wchar_t** |
NULL-terminated array of wide C strings |
|
struct* |
pointer to struct (argument or return) ( |
|
union |
same as |
|
struct[] |
array of structs, contiguous in memory |
|
<T> (*fp)() |
function pointer (Java or native) |
|
varies |
depends on definition |
|
long |
platform-dependent (32- or 64-bit integer) |
|
pointer |
same as |
}