【发布时间】:2016-11-03 09:37:57
【问题描述】:
我正在为我的应用程序开发 JNA,我对在 java 中使用 typedef struct pointer 感到困惑。 请检查我的代码并指导我。 提前谢谢!
下面是我的 c++ 代码
typedef struct tagHWDeviceInfo
{
USHORT VendorID; // vendor id
USHORT ProductID; // product id
DWORD nXExt; // firmware width
DWORD nYExt; // firmware height
DWORD preesure; // pressure level
DWORD penState; // pen state
}HWDeviceInfo, *PHWDeviceInfo;
和java代码
public class HWDeviceInfo extends Structure{
short VendorID;
short ProductID;
int nXExt; // firmware width
int nYExt; // firmware height
int preesure; // pressure level
int penState;
}
现在我的问题是:*PHWDeviceInfo 在 c++ 代码中是什么意思,如何在我的 java 代码中使用这个指针?
【问题讨论】:
-
你到底有什么不明白的?这是一个指针。见这里:stackoverflow.com/questions/1543713/…
-
而且您不能真正在 Java 代码中使用指针。你能用它做什么?
-
您以前曾与 JNA 合作过吗?我们可以在 jna.jar 中使用 Pointer 类。我知道我们不能在 java 中使用指针,但请理解我的问题。
-
@СӏаџԁеМаятіи 看这篇文章JNA Overview
标签: java c++ pointers struct jna