Arrays
J/Direct automatically handles arrays of scalars. The following Java array types translate directly into native pointer types:
Java | Native | # bytes per element |
byte[] | BYTE* | 1 |
short[] | SHORT* | 2 |
int[] | DWORD* | 4 |
float[] | FLOAT* | 4 |
double[] | DOUBLE* | 8 |
long[] | __int64* | 8 |
boolean[] | BOOL* | 4 |
The char[] array type maps to CHAR* unless the unicode modifier is in effect, in which case it maps to WCHAR*.
All scalar array parameters can be modified by the caller (such as [in, out] parameters).
Array types cannot be used as return types. There is no support for arrays of objects or strings.
Typically, this facility is used by OLE functions to return values. (OLE functions reserve the "function" return value to return the HRESULT error code.) See Invoking OLE API Functions to learn how to obtain the return value for OLE functions.