代码
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);
}

相关文章:

  • 2021-12-30
  • 2021-09-27
  • 2022-02-27
  • 2021-06-01
  • 2022-01-05
  • 2021-07-19
  • 2021-09-12
  • 2021-12-20
猜你喜欢
  • 2021-11-11
  • 2021-07-02
  • 2021-09-29
  • 2021-04-21
  • 2021-11-14
  • 2021-10-25
  • 2021-12-25
相关资源
相似解决方案