Ok, so I'll ditch the by reference for this case. I'll also let the variable
length stuff allocated at the end stay put for the moment.
So if I have a native function on windows like
int foo(PX * x);
and a structure X defined as
typdef struct _X {int a; int b; } X;
typedef X * PX;
The function foo will allocate an X and put the ptr into the pointer to which x
refers (*x).
I can in Java create a class
class PX extends Structure {
public int a;
public int b;
}
define foo as
int foo(PX x);
and away I go? How does JNA know that x is returned by reference and that it's
allocated in the native code? How would I distinguish from the case where I
actually pass a ptr to a PX object, rather than a ptr to a ptr to a PX object?
Now also, if my structure PX has a nested structure
class P1 extends Structure {
public int a1;
public int b1;
}
public class PX extends Structure
public P1 p1;
public int a;
public int b;
}
Does this also 'just work' or do I need to do something else?
Cheers
jay