Thursday, August 8, 2002 08:10 AM
You need to use the
SetObjectArrayElement methods for that purpose. These methods will give you access to the object elements of your array and then you will still have to use the JNI methods to access the fields of these elements.
A simpler way to do this would be to use JunC++ion. JunC++ion allows you to generate C++ proxy classes for existing Java classes plus native method implementations that delegate to C++-style methods.
You would end up writing something like:
//users is the argument being passed as type User::array1D
if( users == null )
throw IllegalArgumentException( "users was null" );
for( int i=0; users.length; i++ )
String name = users[ i ].name;
int age = users[ i ].age;
//use the data natively...
Notice that this is C++ code, not Java code, yet it's as readable and maintainable as your Java code.
Check it out.