文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>how to use Pointer in JNA.

how to use Pointer in JNA.

时间:2010-09-05  来源:jrvin

代码
int PTOsetApiOpt(int iOpt,void* lpValue,int iLen)

Parameters: iOpt:
int
lpData: address from which data should be read.
iLen: length of data
returns
int values : 0 as success or -1 as failure.

 

For example

IN C

int PTOsetApiOpt(int iOpt,void* lpValue,int iLen)


Parameters: iOpt: int
lpData
: address from which data should be read.
iLen
: length of data
returns
int values : 0 as success or -1 as failure.


Here's how i wrote it in Java..
void* lpValue can be any type. So in C it is expecting address of int value.
代码public MyTest{

public interface MyLibrary extends Library {
public int PTOsetApiOpt(int iOpt,Pointer lpValue,int iLen);

}
public static void main(String[] args) {
MyLibrary myLib
= (MyLibrary)MyLibrary.INSTANCE;
IntByReference ir
= new IntByReference(1);
//got a result as 0 instead of -1.
int result = myLib.PTOsetApiOpt(1, ir.getPointer() , ir.getPointer().SIZE);
}

 


 
相关阅读 更多 +
排行榜 更多 +
毒药轮盘手机版下载

毒药轮盘手机版下载

休闲益智 下载
剑侠情缘零b服手游下载

剑侠情缘零b服手游下载

角色扮演 下载
惊魂动物园游戏手机版下载

惊魂动物园游戏手机版下载

冒险解谜 下载