2011-08-04 70 views
1

如何设置指向布尔值的指针?对于长期使用:JNA将指针设置为布尔值

Pointer pointer = new Memory (size); 
pointer.setLong(0, longValue); 

pointer.setBoolean(...)没有定义,所以对于布尔我托盘使用SETINT但不工作坚持。

+0

布尔型不是C类型。找出你的库用什么大小的数据类型来表示布尔值并使用它。 – technomage

回答

0

使用IntByReference。

IntByReference ref = new IntByReference(); 
    /*Pass ref as argument to some function*/ 
    if(ref.getValue() == 0) 
    ... 
    else 
    ...