作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 C 中有以下语法方法。
ipj_error ipj_get_value(
ipj_iri_device* iri_device, /**< [in] IRI device data structure */
ipj_key key, /**< [in] Key code to get */
uint32_t* value) /**< [out] Data buffer to store retrieved value */
{
return ipj_get(iri_device, key, 0, 0, value);
}
在此方法中引用值。我如何在 JNA 中定义它?我尝试声明为 int 但没有任何意义。因为在 C 中 value 返回一些东西,而在 Java 中如果我将它声明为 int ,则意味着我将整数值传递到方法中。那么我如何声明这个 ipj_get_value 以及如何声明该值?请指教。
我也尝试过 IntByReference。但是当我尝试使用 getValue() 获取值时,它总是返回 0。
最佳答案
JNA提供IntByReference
用于通过引用传递 32 位值。
int passedValue = ...;
IntByReference iref = new IntByReference(passedValue);
lib.invokeMyMethod(iref);
int returnedValue = iref.getValue();
关于java - 如何将以下引用变量转换为 Java JNA?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33602369/
我是一名优秀的程序员,十分优秀!