1 Reply Latest reply on Jan 31, 2012 10:38 PM by EJP

    GetIntArrayElements  lost data


      I am doing a Java program and it´s using an external library. It is C++ and I have done a header file with the JNI´s header whit a mapper one-to-one for Java-C
      C++ and Java are compiled on 64bit with gcc and jdk1.6_0_27 and I generate the new library
      ok, it´s working but with problems. After debug the code, I watch that when Java pass a Int array and C recovers it whit ‘getIntArryElements(…..)’ some elements are lost.
      I watch that C recovers only the pairs Java Array´s elements, ex:
      Java pass the array: int[] javaArray = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
      Now C reads only: int[] cArray ={0, 2, 4, 6, 8}
      This is my code:
      Java_IntArray_Method(JNIEnv *env, jobject obj, jintArray arr)
      jint *cArray;     
      cArray = (env)->GetIntArrayElements(env, arr, 0);

      Thank You