Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Returning an int[] from java to C using JNI

I have a C program that invokes a java program but I have a problem: my java program returns an int [], how can I use JNI to get the result of it in C, since JNI only has CallIntMethod?

like image 823
shawn Avatar asked Dec 04 '25 07:12

shawn


1 Answers

Arrays are objects, so you can use CallObjectMethod(). Use GetIntArrayElements() to access the array elements.

like image 87
Christoph Walesch Avatar answered Dec 05 '25 19:12

Christoph Walesch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!