Passing Image Data from Java to C Native function accepting pointers

扶醉桌前 提交于 2019-12-23 20:26:23

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/29138195/passing-image-data-from-java-to-c-native-function-accepting-pointers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!