Most JNA documentation assumes you're using C, not Delphi, so start with the C equivalent to that function:
int DoX(const void* InputBuffer,
unsigned int InputBufferSize,
void* OutputBuffer,
unsigned int* OutputBufferSize);
You'll also want to get the calling convention right. Delphi's default is register, which probably isn't what you want. Use stdcall instead; that's what every other DLL uses.
Java doesn't have unsigned type equivalents to the ones you used, so start by ignored the unsignedness. That makes InputBufferSize
an int
. Your function returns a Boolean result, so use boolean
for its return type. JNA supports passing types by reference through descendants of the ByReference
class, so use IntByReference
for OutputBufferSize
.
Finally are the pointers. You said they're byte arrays, so I'm puzzled why you don't declare them that way in your Delphi code. Either use PByte
, or declare a new PByteArray
type and use that. (That change will make implementing that function much more convenient.) In Java, try declaring them as byte arrays. So, the final product:
boolean DoX(byte[] InputBuffer,
int IntputBufferSize,
byte[] OutputBuffer,
IntByReference OutputBufferSize);