Quick Reference

The following two tables list the native type that corresponds to each Java type. The first table describes the mappings for parameters and return values, and the second table shows the mappings that are used with the @dll.struct directive.

Parameter and Return Value Mappings

Java Native Notes/Restrictions
byte BYTE or CHAR
short SHORT or WORD
int INT, UINT, LONG, ULONG, or DWORD
char TCHAR
long __int64
float float
double double
boolean BOOL
String LPCTSTR Not allowed as return value, except in ole mode. In ole mode, String maps to LPWSTR. The Microsoft VM frees the string by using CoTaskMemFree.
StringBuffer LPTSTR Not allowed as return value. Set the StringBuffer capacity large enough to hold the largest string that the DLL function can generate.
byte[] BYTE*
short[] WORD*
char[] TCHAR*
int[] DWORD*
float[] float*
double[] double*
long[] __int64*
boolean[] BOOL[]
Object pointer to struct In ole mode, an IUnknown* is passed instead.
Interface COM interface Use jactivex or similar tool to generate interface file.
com.ms.com.SafeArray SAFEARRAY* Not allowed as return value.
com.ms.com._Guid GUID,IID,CLSID
com.ms.com.Variant VARIANT*
@dll.struct classes pointer to struct
@com.struct classes pointer to struct
void VOID As return value only.
com.ms.dll.Callback function pointer As parameter only.

Mappings used with @dll.struct

Java Native
byte BYTE or CHAR
char TCHAR
short SHORT or WORD
int INT, UINT, LONG, ULONG or DWORD
float __int64
long float
double double
boolean BOOL[]
Java Native
String Pointer to a string, or an embedded fixed-size string
Class marked with @dll.struct Nested structure
char[] Nested array of TCHAR
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