On Sat, 16 May 2009 21:42:56 -0400
Timothy Wall <twal...@dev.java.net> wrote:
...
The C function is:
f(struct my_struct *s[])
In Java it becomes:
class my_struc extends Structure { ... }
int f(my_struct[] s);
How do you know how big the array is? If you don't know, then you
can't safely access even a single element, in C *or* Java.
I know, so I tried to define a large enough array and passed it
to f in the hope of seeing something.
If you don't ever access the structure array (i.e. you get it as a
result of some other function call), you can just treat it as a
Pointer.
I need to access the structure array as the result will be contained in
it.
The counterpart of an array of pointers what I need, I just uncertain
how to approach that.
The API doc says on Structure:
When used as a function parameter or return value, this class
corresponds to struct*.
So I tried passing a variable of my Structure and using its toArray()
method with the size that was given back via an IntByReference by the
function. This does not seem to work either.
Just to be clear here is the defining C code:
struct my_struct
int f(struct my_struct *s, int *i)
In usage it looks:
static struct my_struct my_s
static unsigned int my_i
(call) f(&my_s, &my_i)
(use) my_s[0]
Zsolt