1 使用
点击跳转 JNA地址
jna.jar 下载
- 下载jna.jar 导入,并导入so库
- 定义JNA 接口,统一将so库function 封装到接口中
public interface IJnaLibrary extends Library {
public static final String JNA_LIBRARY_NAME = "so file name";
public static final NativeLibrary JNA_NATIVE_LIB = NativeLibrary.getInstance(IJnaLibrary.JNA_LIBRARY_NAME);
public static final IJnaLibrary INSTANCE = Native.loadLibrary(IJnaLibrary.JNA_LIBRARY_NAME, IJnaLibrary.class);
/**
*
* @param hDevHandle 设备句柄
* @param psDevStatus 自定义结构体 out
* @param psStatus 错误码及错误信息 out
* @return
*/
int GetDevStatus(HANDLE hDevHandle, DevStatus psDevStatus, ErrorDesc psStatus);
}
- 调用,在外层包装类中调用,