0

I am using JNA for access to native functions. In my native function one my method is returning byte pointer. How could I get same byte array values as return in JNA? I have tried by getting as string and convert it to bytes but it's not working.

This is my code:

BYTE* GetImageDate(); // in C++

1 Answer 1

1

Return a pointer, then use Pointer.getByteArray(0, size) to extract size bytes from the corresponding memory location.

Note that you'll have to somehow figure out what size is, unless the function is returning a NUL-terminated C string.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.