Microsoft SDK for Java

offsetOf

The offsetOf method of the DllLib class contains the following signatures:

offsetOf(Field structField)
offsetOf(Class structCls, String fieldName)

offsetOf(Field structField)

Returns the offset (measured in bytes) of a member of a native structure. The class, which is represented by structField.getClass, must have been declared using the @dll.struct compiler directive (or @com.struct).

Note   The getClass method is from the java.lang.Object class.

Syntax

public native static int offsetOf(Field structField);

Return Value

Returns the size of the native structure (in bytes).

Parameters

structField The field to obtain the offset of.

offsetOf(Class structCls, String fieldName)

Returns the offset (measured in bytes) of a member of a native structure. The class, which is represented by structCls, must have been declared using the @dll.struct compiler directive (or @com.struct).

Syntax

public static int offsetOf(Class structCls, String fieldName) throws SecurityException;

Return Value

Returns the size of the native structure in bytes.

Parameters

structCls The class declared by using @dll.struct.
fieldName The name of the field to examine.

Exceptions

SecurityException if the caller lacks permissions to use the java.lang.reflect API.

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