简体   繁体   中英

Passing Image Data from Java to C Native function accepting pointers

I have been provided a C function in an external .so file. This function takes Image data as input and provides the compressed image along with lengh of the image as output.

The function template is as follows:

char *OutputImage = CompressImage((char *)InputImage, (int)&lenOutImage);

In my Java code, I capture the input image as byte[] data type. Now I need to pass this to native C function mentioned above. Can you please help how I can achieve this from Java?

You have 2 options, use JNI, or JNA. Discussing how to do that in detail is to big for this platform.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM