The following table describes how scalar types map inside structures.
Java | Native |
byte | BYTE |
char | TCHAR (CHAR or WCHAR depending on @dll.struct definition) |
short | SHORT |
int | LONG |
long | __int64 |
float | float |
double | double |
boolean | BOOL (32-bit boolean) |
Reference types (Java objects and classes) normally map to embedded structures and arrays. Each supported mapping is described in the following table.
Java | Native |
String | Pointer to a string, or an embedded fixed-string string |
Class marked with @dll.struct | Nested structure |
char[] | Nested array of TCHAR (CHAR/WCHAR) |
byte[] | Nested array of BYTE |
short[] | Nested array of SHORT |
int[] | Nested array of LONG |
long[] | Nested array of __int64 |
float[] | Nested array of floats |
double[] | Nested array of doubles |
There is no direct support for pointers inside structures due to the large number of possible ways referenced objects could be allocated and disposed of. To represent a structure with an embedded pointer, declare the pointer field as type int. You will need to make explicit DLL calls to the appropriate allocation functions and initialize the memory blocks yourself. (You could use DllLib.ptrToStruct to map the blocks onto @dll.struct classes.)