The reason is probably just as simple: the name is not a pointer to an analogue of C.
Let me show you two examples:
WITH
typedef struct{ char * name; }MyCStruct;
maps to Java:
class MyJStruct extends Structure{ Pointer name; }
But in this other scenario (in which I think you ended up):
WITH
typedef struct{ char name[16]; }MyCStruct;
maps to Java:
class MyJStruct extends Structure{ byte[] name = new byte[16]; }
In the first case, the C structure contains a pointer, and sizeof the size of the pointer (4 or 8 bits depending on 32/64 bits), in the second case, it contains the entire array, which means that the size is 16 bytes.
This explains the difference between the two Java mappings: JNA needs to know how to read the structure fields, and also explains why you are name.getByteArray(0, 16) error when calling name.getByteArray(0, 16) , as it expresses the following:
- take the first 4 bytes after the
flags field - treat it as a pointer
- go to ram to the specified address and read 16 bytes
Which is a failure, since the indicated memory zone is probably inaccessible to the program.
You can check it yourself on C: if sizeof(struct Frame) is 24, then the structure stores the whole array, if it is 12 (or 16), then it contains a pointer to 32 bits (or a pointer to 64 bits)
The official documentation on this is pretty clear, but hard to find, so here you go:
http://twall.github.com/jna/3.3.0/javadoc/overview-summary.html
you will find it in the Nested Arrays section, and I really recommend that you read the section just below the " Variable-Size Structures "
hope this helps
considers