Hi,
Am having trouble with passing multi-dimensional arrays from C++ to Java.
The Java method receives an object but it's contents are null.
The received (in Java) object's length is correct.
If I only have a 2d array, I do not encounter a problem.
// Create the class
jclass intClass = env->FindClass("[I");
// Create 1st and 2nd array
jobjectArray array1 = env-> NewObjectArray(30, intClass, NULL)
jobjectArray array2 = env-> NewObjectArray(2, intClass, NULL)
// Create 3rd Array
jintArray array3 = env->NewIntArray(100);
// Put some data into array3
env-> SetIntArrayRegion(array3 , 0, 1, myBuffer);
// Add array 3 to array 2 and array 2 to array 1
env->SetObjectArrayElement(array2 , 0, array3);
env->SetObjectArrayElement(array1 , 0, array2 );
// Call the Java method
env->CallVoidMethod(obj, mid, array1 )
I have checked before calling the Java method that all 3 arrays are created and have the correct sizes.
The example in Sheng Liang's book is only for 2d Arrays.
Any ideas ?
Many thanks.
Andy