JNA-5.5.0-API文档
| C Type | Native Representation | Java Type |
| char | 8-bit integer | byte |
| wchar_t | platform-dependent | char |
| short | 16-bit integer | short |
| int | 32-bit integer | int |
| int | boolean flag | boolean |
| enum | enumeration type | int (usually) |
| long long, __int64 | 64-bit integer | long |
| float | 32-bit floating point | float |
| double | 64-bit floating point | double |
| pointer (e.g. void) | platform-dependent (32- or 64-bit pointer to memory) | Buffer
Pointer
|
| pointer (e.g. void),
array | 32- or 64-bit pointer to memory (argument/return)
contiguous memory (struct member) | <P>[] (array of primitive type) |
| In addition to the above types, which are supported at the native layer, the JNA Java library automatically handles the following types. All but NativeMapped
and NativeLong
are converted to Pointer
before being passed to the native layer. |
| long | platform-dependent (32- or 64-bit integer) | NativeLong
|
| const char* | NUL-terminated array (native encoding or jna.encoding
) | String
|
| const wchar_t* | NUL-terminated array (unicode) | WString
|
| char** | NULL-terminated array of C strings | String[]
|
| wchar_t** | NULL-terminated array of wide C strings | WString[]
|
| void** | NULL-terminated array of pointers | Pointer[]
|
| struct*
struct | pointer to struct (argument or return) (or explicitly
)
struct by value (member of struct) (or explicitly
) | Structure
|
| union | same as Structure
| Union
|
| struct[] | array of structs, contiguous in memory | Structure[]
|
| void (*FP)() | function pointer (Java or native) | Callback
|
| pointer (<T> *) | same as Pointer
| PointerType
|
| other | integer type | IntegerType
|
| other | custom mapping, depends on definition | NativeMapped
|
JNA 类型对照表
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 文章开始之前首先介绍下.dll/.so文件,我们知道用c/c++编写的程序如果用于Windows平台则编译为xxx...
- 一、JNA技术的难点 上篇文章我们成功实现了Java使用JNA调用C/C++的函数代码: 上面的代码非常简单,在控...