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

Buffer
Pointer

pointer

platform-dependent (32- or 64-bit pointer to memory)

<T>[] (array of primitive type)

pointer
array

32- or 64-bit pointer to memory (argument/return)
contiguous memory (struct member)

除了上面的类型,JNA还支持常见的数据类型的映射。

String

char*

NUL-terminated array (native encoding or jna.encoding)

WString

wchar_t*

NUL-terminated array (unicode)

String[]

char**

NULL-terminated array of C strings

WString[]

wchar_t**

NULL-terminated array of wide C strings

Structure

struct*
struct

pointer to struct (argument or return) (or explicitly)
struct by value (member of struct) (or explicitly)

Union

union

same as Structure

Structure[]

struct[]

array of structs, contiguous in memory

Callback

<T> (*fp)()

function pointer (Java or native)

NativeMapped

varies

depends on definition

NativeLong

long

platform-dependent (32- or 64-bit integer)

PointerType

pointer

same as Pointer

}

posted @ 2019-11-12 16:26  YZFHKMS-X  阅读(994)  评论(0编辑  收藏  举报