copying 2d array from C JNI.

G

ganeshamutha

Hi,


how to copy the 2D array to java from C which connected with
JNI.

i used following statement 1D array which was worked very
fine..

(*env)->SetDoubleArrayRegion(env,ans,0,len,res);

ans -> 2D array declared in Java
res -> 2D array declared in C

when i changed the dimension i got following warning
which making shared lib..

: warning: passing argument 5 of '(*env)-
SetDoubleArrayRegion' from incompatible pointer type

What should i do to pass 2d array to java from C.. how do
remove this warning .

Please any one of you help me out to solve..

Thanks in advance,
Ganesh.
 
G

Gordon Beaton

how to copy the 2D array to java from C which connected with
JNI.
[...]

: warning: passing argument 5 of '(*env)->SetDoubleArrayRegion' from
incompatible pointer type

Each element of the 2D array is itself a 1D array. The 2D array is
array-of-Object, not array-of-Double.

You need to do this 1 array at a time, i.e. iterate over the 2D array,
then handle each element just like the 1D case.

/gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,226
Latest member
KristanTal

Latest Threads

Top