使用JNI将数组数组从java传递到C. [英] passing array of arrays from java to C with JNI

查看:301
本文介绍了使用JNI将数组数组从java传递到C.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个int数组,如int [] [] arrays = {array1,array2,array3,array4,array5};其中 array1 = 30,40,20,40 array2 = 40,20,30,30 我试图使用JNI将此数组发送到C.我找不到任何明确的解决方案。我试图把这个int作为一个inarray但没有成功。



有没有办法做到这一点?

I have a int array like int[][] arrays = { array1, array2, array3, array4, array5 };where array1=30,40,20,40 ,array2=40,20,30,30 and I am trying to send this array to C with using JNI. I could not find any clear solution for this. I have tried to take this int as a intarray but no success.

Is there a way to do this?

推荐答案

我发现这个很好的 JNI的Java编程教程示例为int数组。



非常重要的是要小心释放所有内存,否则jni会遇到麻烦而没有任何明显错误。
I found this fine Java Programming Tutorial for JNI with example for int array.

Very important is to release all memory carefully or the jni gets into trouble without any clear errors.

这篇关于使用JNI将数组数组从java传递到C.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆