Raw Native Interface Structures
 
 

Java & Native Code    RNI
Raw Native Interface Structures     RNI

 


Raw Native Interface Structures

The following structures are found in the native.h header file. RNI uses these structures to access Java arrays and wrap native code for the Microsoft Virtual Machine.

The ThreadEntryFrame and GCFrame structures are used in several RNI functions but are not manipulated directly by the user.

The ClassArrayOf* structs all share the same architecture. The MSReserved field is reserved for the Microsoft Virtual Machine. Each struct contains a length and body field. The body field is a variable length array, with the array's length stored in the length field.

Structures that handle strings and arrays of strings have different architecture because the Virtual Machine handles strings differently in certain situations.

ThreadEntryFrame

typedef struct {
	DWORD	reserved[6];
} ThreadEntryFrame;

This structure is used in the PrepareThreadForJava and UnprepareThreadForJava functions. These functions are thread exit and entry functions that wrap calls into the VM.

ParameterDescription
reserved Reserved for the Microsoft Virtual Machine.

GCFrame

typedef struct {
	DWORD	reserved[6];
} GCFrame;

This structure is used to wrap a garbage collection frame from native RNI code. It is used in the GCFramePush and GCFramePop methods. For more information on garbage collection issues, see Overview of the Garbage Collection Architecture and in the Raw Native Interface documentation.

ParameterDescription
reserved Reserved for the Microsoft Virtual Machine.

ClassArrayOfByte

typedef struct ClassArrayOfByte
{
    int32_t MSReserved;
    unsigned long length;
    char body[1];
} ClassArrayOfByte;

This structure is used to access Java arrays of bytes from native RNI code.

ParameterDescription
MSReserved Reserved for the Microsoft Virtual Machine.
length The length of the array (in bytes).
body A variable length array of chars (it is declared as one element because not all C compilers support [] declarations).

ClassArrayOfChar

typedef struct ClassArrayOfChar
{
    int32_t MSReserved;
    unsigned long length;
    unsigned short body[1];
} ClassArrayOfChar;

This structure is used to access Java arrays of chars from native RNI code.

ParameterDescription
MSReserved Reserved for the Microsoft Virtual Machine.
length The length of the array (in shorts).
body A variable length array of shorts (it is declared as one element because not all C compilers support [] declarations).

ClassArrayOfShort

typedef struct ClassArrayOfShort
{
    int32_t MSReserved;
    unsigned long length;
    short body[1];
} ClassArrayOfShort;

This structure is used to access Java arrays of short type primitives from native RNI code.

ParameterDescription
MSReserved Reserved for the Microsoft Virtual Machine.
length The length of the array (in shorts).
body A variable length array of shorts (it is declared as one element because not all C compilers support [] declarations).

ClassArrayOfInt

typedef struct ClassArrayOfInt
{
    int32_t MSReserved;
    unsigned long length;
    long body[1];
} ClassArrayOfInt;

This structure is used to access Java arrays of ints from native RNI code.

ParameterDescription
MSReserved Reserved for the Microsoft Virtual Machine.
length The length of the array (in longs).
body A variable length array of longs (it is declared as one element because not all C compilers support [] declarations).

ClassArrayOfLong

typedef struct ClassArrayOfLong
{
    int32_t MSReserved;
    unsigned long length;
    __int64 body[1];
} ClassArrayOfLong;

This structure is used to access Java arrays of long type primitives from native RNI code.

ParameterDescription
MSReserved Reserved for the Microsoft Virtual Machine.
length The length of the array (in 64-bit ints).
body A variable length array of 64 bit ints. (it is declared as one element because not all C compilers support [] declarations).

ClassArrayOfFloat

typedef struct ClassArrayOfFloat
{
    int32_t MSReserved;
    unsigned long length;
    float body[1];
} ClassArrayOfFloat;

This structure is used to access Java arrays of floats from native RNI code.

ParameterDescription
MSReserved Reserved for the Microsoft Virtual Machine.
length The length of the array (in floats).
body A variable length array of floats (it is declared as one element because not all C compilers support [] declarations).

ClassArrayOfDouble

typedef struct ClassArrayOfDouble
{
    int32_t MSReserved;
    unsigned long length;
    double body[1];
} ClassArrayOfDouble;

This structure is used to access Java arrays of doubles from native RNI code.

ParameterDescription
MSReserved Reserved for the Microsoft Virtual Machine.
length The length of the array (in doubles).
body A variable length array of doubles (it is declared as one element because not all C compilers support [] declarations).

ClassArrayOfObject

typedef struct ClassArrayOfObject
{
    int32_t MSReserved;
    unsigned long length;
    HObject *body[1];
} ClassArrayOfObject;

This structure is used to access Java arrays of Objects from native RNI code.

ParameterDescription
MSReserved Reserved for the Microsoft Virtual Machine.
length The length of the array (in object references).
body A variable length array of HObject pointers (it is declared as one element because not all C compilers support [] declarations).

ClassArrayOfString

typedef struct ClassArrayOfString
{
    int32_t MSReserved;
    unsigned long length;
    HString  *(body[1]);
} ClassArrayOfString;

This structure is used to access Java arrays of String types from native RNI code.

ParameterDescription
MSReserved Reserved for the Microsoft Virtual Machine.
length The length of the array (in string pointers).
body A variable length array of HString pointers (it is declared as one element because not all C compilers support [] declarations).

ClassArrayOfArray

typedef struct ClassArrayOfArray
{
    int32_t MSReserved;
    unsigned long length;
    JHandle *(body[1]);
} ClassArrayOfArray;

This structure is used to access Java two-dimensional arrays from native RNI code.

ParameterDescription
MSReserved Reserved for the Microsoft Virtual Machine.
length The length of the array (in elements).
body A variable length array of JHandle pointers (it is declared as one element because not all C compilers support [] declarations).

ArrayOfSomething

typedef struct
{
    int32_t MSReserved;
    unsigned long length;
} ArrayOfSomething;

This structure serves as a base structure from which others that access Java arrays are derived.

ParameterDescription
MSReserved Reserved for the Microsoft Virtual Machine.
length The length of the array. Array lengths are measured in the unit of the array, not in bytes.

Top © 1998 Microsoft Corporation. All rights reserved. Terms of use.