I have a C function, which creates an array of structs
int createArray(myStruct** data_array);
From C I call the function like this:
myStruct* data_array;
int size = createArray(&data_array);
I want to call createArray in a similar way with JNA. I've generated the wrapper using JNAerator.
int createArray(myStruct.ByReference[] data_array);
I don't know what to pass to the JNA method createArray since data_array is actually a output parameter. I actually think the generated JNA method is wrong since I don't want to pass an array of myStruct, I want to receive one.
Shouldn't the parameter of the JNA method be PointerByReference?
Here are some tries that didn't worked for me
PointerByReference ptr = new PointerByReference();
int size = api.createArray(ptr); //Invalid memory access
myStruct.ByReference[] array = new myStruct.ByReference[10];
Arrays.fill(stLinks, new myStruct.ByReference()); //without this I get NullpointerException
int size = api.createArray(array); //Invalid memory access