My C ++ function
extern "C" {
DECLSPEC unsigned int STDCALL doNumberThing(unsigned int some_number);
}
My java interface
package com.myplace.nativeapi;
import com.sun.jna.Library;
import com.sun.jna.Memory;
import com.sun.jna.Pointer;
interface NativeAPI extends Library {
int doNumberThing(int some_number);
}
Obviously, this matters when dealing with values that are valid only for one or the other of the inconsistent types (int vs unsigned int); What is the recommended way to get around this? One answer elsewhere recommends "IntByReference", but if I do not understand, they are talking about a long *, and not that the actual unsigned int is passed by value.
(This is a shortened sample code, if there is a syntax error, let me know in the comments and I will update the question)
source
share