JNA编程之二:数据类型映射

来源:互联网 发布:校园暴力怎么应对知乎 编辑:程序博客网 时间:2024/05/06 13:53
以下关于C/C++及Java数据类型间的映射关系摘自JNA官网,由于笔者英语水平有限就不做翻译了,但是只要你曾经是个C/C++程序员,估计能领悟到它的具体意思。

Default Type Mappings

Java primitive types (and their object equivalents) map directly to the native C type of the same size.

Native TypeSizeJava TypeCommon Windows Typeschar8-bit integerbyteBYTE, TCHARshort16-bit integershortWORDwchar_t16/32-bit charactercharTCHARint32-bit integerintDWORDintboolean valuebooleanBOOLlong32/64-bit integerNativeLongLONGlong long64-bit integerlong__int64float32-bit FPfloat double64-bit FPdouble char*C stringStringLPTCSTRvoid*pointerPointerLPVOID, HANDLE, LPXXX

Unsigned types use the same mappings as signed types. C enums are usually interchangeable with "int".


参考链接:https://github.com/twall/jna/blob/master/www/Mappings.md
0 0
原创粉丝点击