A
Arash Nikkar
I have a float array, and I am trying to pass it to a java method, but
it craps out during the call to pass the array. Anyone have any ideas?
Here is the header for the java method:
public void addPoints(final float[] scopePoints)
and here is the C++ reference to this method:
addPoints = jenv->GetMethodID(myClass, "addPoints", "([F)V");
lastly, here is the code in question (the printMsg function is just a
helper function which calls a println method in my java class). Also,
SampleData is defined as such: float SampleData[3072];
jfloat realGraph[3000];
printMsg("created jint array\n");
for (i=0;i<3000;i++)
{
realGraph = SampleData;
}
printMsg("copied array\n");
jfloatArray returnArray = jenv->NewFloatArray(3000);
printMsg("created java jint array\n");
jenv->SetFloatArrayRegion(returnArray,
0,3000,realGraph);
printMsg("transfered data into java array\n");
jenv->CallVoidMethod(job, addPoints, returnArray); //THIS IS
WHERE IT FAILS!!!
printMsg("passed the array\n");
when i run the code, all of the print messages come through except the
last one. I also added loops which printed out the contents of each
array (SampleData, realGraph, & returnArray), and they all contain the
correct contents.
Any help is appreciated
it craps out during the call to pass the array. Anyone have any ideas?
Here is the header for the java method:
public void addPoints(final float[] scopePoints)
and here is the C++ reference to this method:
addPoints = jenv->GetMethodID(myClass, "addPoints", "([F)V");
lastly, here is the code in question (the printMsg function is just a
helper function which calls a println method in my java class). Also,
SampleData is defined as such: float SampleData[3072];
jfloat realGraph[3000];
printMsg("created jint array\n");
for (i=0;i<3000;i++)
{
realGraph = SampleData;
}
printMsg("copied array\n");
jfloatArray returnArray = jenv->NewFloatArray(3000);
printMsg("created java jint array\n");
jenv->SetFloatArrayRegion(returnArray,
0,3000,realGraph);
printMsg("transfered data into java array\n");
jenv->CallVoidMethod(job, addPoints, returnArray); //THIS IS
WHERE IT FAILS!!!
printMsg("passed the array\n");
when i run the code, all of the print messages come through except the
last one. I also added loops which printed out the contents of each
array (SampleData, realGraph, & returnArray), and they all contain the
correct contents.
Any help is appreciated