I have the following syntax method in 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);
}
In this method the reference to value. How can I define that in JNA? I tried declaring as int but it doesn't make any sense. Because in C value returns something while in Java if I declare it as int it means im passing an integer value into the method. So how can I declare this ipj_get_value and how would the value be declared? Please advice.
I tried IntByReference as well. But when I try to get the value using getValue() its always returning 0.
JNA provides IntByReference
for passing 32-bit values by reference.
int passedValue = ...;
IntByReference iref = new IntByReference(passedValue);
lib.invokeMyMethod(iref);
int returnedValue = iref.getValue();