Microsoft SDK for Java

Marshaling Arrays

J/Direct automatically handles arrays of scalars. The following Java array types translate directly into native pointer types as shown in the following table.

Java Array Types

Java Native Number of 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 (like [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.) To learn how to obtain the return value for OLE functions, see Invoking OLE API Functions.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.