Jna Using Pointers and Arrays as int*

Primitive array arguments (including structs) are represented by their corresponding Java types. For example:

// Original C declarations
void fill_buffer(int *buf, int len);
void fill_buffer(int buf[], int len); // same thing with array syntax

// Equivalent JNA mapping
void fill_buffer(int[] buf, int len);

NOTE: if the parameter is to be used by the native function outside thescope of the function call, you must use Memory or anNIO Buffer. The memory provided by a Java primitive array will only be validfor use by the native code for the duration of the function call.

Arrays of C strings (the char* argv[] to the C main,for example), may be represented by String[] in Java code. JNAwill pass an equivalent array with a NULL final element.

转载于:https://www.cnblogs.com/jrvin/archive/2010/09/01/1815325.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值