标签:
JNA以结构体数组为参数进行调用:
运行报错:
Structure array elements must use contiguous memory (bad backing address at Structure array index 1)
结构体数组必须使用连续的内存区域, 上例s1,s2都是new出来的新对象,不可能连续; 也就是说传统方式的初始化数组不能解决, 查询JNA api发现里面提供了:
public Structure[] toArray(int size)
Returns a view of this structure‘s memory as an array of structures. Note that this Structure
must have a public, no-arg constructor. If the structure is currently using a Memory
backing, the memory will be resized to fit the entire array.
修改后的代码:
http://tcspecial.iteye.com/blog/1665583 //原文地址
标签:
原文地址:http://www.cnblogs.com/shaohaixiong/p/5486511.html