美文网首页
JNA 类型对照表

JNA 类型对照表

作者: BlackR_ | 来源:发表于2021-07-27 11:15 被阅读0次

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 类型对照表

      本文链接:https://www.haomeiwen.com/subject/czdwfhtx.html