Passing an array of objects.
I have been trying to pass an array of objects from java to C. They are simple objects, only fields, no methods.
Example...
class User
{
String name;
int id;
}
public class JNIExample
{
User[] users = new User[10];
public native void nativeCode(User[] usersarray);
static
{
try{
System.loadLibrary("object");
}catch(Exception e)
{
System.out.println("Could not load library.");
}
}
public static void main(String[] args)
{
JNIExample anex = new JNIExample();
anex.nativeCode(anex.users);
}
}
Could someone give me sample code on how to access the array elements and get/set the object values on the C side. In the above code I did not create any of the objects in the array or set their field values but these will be set on the java side.
Any help would be greatly appr.
Thanks,
Darrin

