Raw Native Interface Reference Previous
Previous
Native Code Interface
Native Code Interface

Raw Native Interface Reference Functions

This reference describes the functions and structures defined in the native.h header file. These functions are used by the Raw Native Interface defined by the Microsoft® VM for efficiently interfacing Java code with native code.

To learn how to use these API, see the overview information in Using the Raw Native Interface.

The following functions are defined in native.h:
ArrayAlloc Creates an array of primitive type objects.
ArrayCopy Copies an array using the Java System.ArrayCopy method.
Class_ArrayAlloc Creates an array of objects.
Class_GetAttributes Returns a combination of the ACC_XXX flags for a class as they appear in the Java class file.
Class_GetField Returns a handle to a field explicitly specified by name.
Class_GetFieldByIndex Returns a handle to a field specified by index.
Class_GetFieldCount Retrieves the total number of fields in the class, including super and static fields.
Class_GetInterface Retrieves an interface specified by index.
Class_GetInterfaceCount Retrieves the total number of interfaces implemented by the class.
Class_GetMethod Returns a handle to a method explicitly specified by name.
Class_GetMethodByIndex Returns a handle to a method specified by index.
Class_GetMethodCount Retrieves the total number of methods in the class, including super and static methods.
Class_GetName Retrieves the class name.
Class_GetSuper Retrieves the superclass name.
do_execute_java_method Calls a Java method or constructor.
exceptionClear Clears any pending exceptions.
exceptionDescribe Invokes printStackTrace on the pending exception.
exceptionOccurred Determines if an exception has occurred in the called Java method without exiting the native code.
execute_java_constructor Allocates a new Java object and invokes a constructor.
execute_java_dynamic_method Invokes a Java dynamic method.
execute_java_static_method Invokes a Java static method.
Field_GetXXX Retrieves the value of the specified field.
Field_GetOffset Returns the offset of dynamic fields in the class.
Field_GetStaticPtr Returns a pointer to the static data.
Field_SetXXX Sets the value of the specified field.
FindClass Retrieves a class object pointer for a named class.
GCDisable Increments the block count and disables garbage collection.
GCDisableCount Disables the counting used by GCEnable and GCDisable.
GCDisableMultiple Increments the block count a specified number of times.
GCEnable Decrements the block count and enables garbage collection by the VM.
GCEnableCompletely Decrements the block count to zero and enables garbage collection by the VM.
GCFramePop Restores the GCFrame with current values for members of the structure.
GCFramePush Informs the VM garbage collector of a GCFrame to track.
GCFreeHandle Frees a "strong pointer" originally obtained using GCNewHandle.
GCFreePtr Frees a pointer originally allocated using GCGetPtr.
GCGetPtr Allocates a "weak" pointer for an object and updates it when GC occurs.
GCNewHandle Creates a "strong pointer" to an object.
get_methodblock Retrieves a pointer to a method block structure containing the class name, method name, and parameter and return types of a method.
isInstanceOf Determines if a specified Java object is an instance of a particular class.
javaString2CString Retrieve the characters of the String object into a C string buffer.
javaStringLength Retrieves the length of the Java String object.
jio_snprintf Prints to a string with a buffer limit.
jio_vsnprintf Prints to a string with a buffer limit using a va_list macro for arguments.
makeJavaString Returns a string formatted as a Java String object.
makeJavaStringW Constructs a Java string from a Unicode C string.
MakeByteString Create and return a new array of bytes initialized from the C string.
Member_GetAttributes Returns a combination of the ACC_XXX flags for a field or method, as appears in the Java class file.
Member_GetClass Retrieves the name of the class that the field or method is implemented in.
Member_GetName Retrieves the member name.
Member_GetSignature Retrieves the signature of the field or method.
Object_GetClass Retrieves the class that the object points to.
SignalError Creates a Java exception object, which is thrown once it returns from the native code.
SignalErrorPrintf Creates a Java exception object and specifies format string for exception description to be printed when thrown.

ArrayAlloc

HObject* __cdecl ArrayAlloc(int type, int cItems);

Creates an array of primitive type objects.

Return Value:

Returns an allocated object array.

ParameterDescription
type Primitive data type as defined in native.h. The following types are supported:
T_BOOLEAN A Boolean object.
T_BYTE A Byte object.
T_CHAR A Character object.
T_CLASS A Class object.
T_DOUBLE A Double object.
T_FLOAT A Float object.
T_INT An Integer object.
T_LONG A Long object
T_SHORT A Short object.
cItems Number of items in the array.


ArrayCopy

void __cdecl ArrayCopy(HObject *srch, long src_pos, HObject *dsth, 
        long dst_pos, long length);

Copies an array using the Java System.ArrayCopy method.

ParameterDescription
srch Source object.
src_pos Starting position in the source object array to copy.
dsth Destination object.
dst_pos Position in the destination object array to copy to.
length Number of objects in the array to copy.


Class_GetAttributes

int __cdecl   Class_GetAttributes(ClassClass *cls);

Retrieves a combination of the ACC_XXX flags for a class as they appear in the Java class file.

Return Value:

Returns attributes flags.

ParameterDescription
cls Address of the class object.

Remarks:

The following attributes are defined for use in a Java class file and can be retrieved using this function:
Flag Value
ACC_PUBLIC 0x0001
ACC_PRIVATE 0x0002
ACC_PROTECTED 0x0004
ACC_STATIC 0x0008
ACC_FINAL 0x0010
ACC_SYNCH 0x0020
ACC_SUPER 0x0020
ACC_THREADSAFE 0x0040
ACC_VOLATILE 0x0040
ACC_TRANSIENT 0x0080
ACC_NATIVE 0x0100
ACC_INTERFACE 0x0200
ACC_ABSTRACT 0x0400


Class_GetField

struct fieldblock * __cdecl Class_GetField(ClassClass *cls, const char *name);

Retrieves a handle to a field explicitly specified by name. This handle is needed to get any further information about the field.

Return Value:

Returns a pointer to the field block.

ParameterDescription
cls Address of the class object. Use FindClass to determine.
name Name of the field in the class.


Class_GetFieldByIndex

struct fieldblock * __cdecl Class_GetFieldByIndex(ClassClass *cls, unsigned index);

Retrieves a handle to a field specified by index.

Return Value:

Returns a field block pointer.

ParameterDescription
cls Address of the class object. Use FindClass to determine.
index Index value of the field in the class. The index must be between 0 and the field count (returned from Class_GetFieldCount) minus 1, inclusive.


Class_GetFieldCount

unsigned __cdecl  Class_GetFieldCount(ClassClass *cls);

Retrieves the total number of fields in the class, including super and static fields.

Return Value:

Returns the number of fields.

ParameterDescription
cls Address of the class object. Use FindClass to determine.

Remarks:

This function is intended to be used with Class_GetFieldByIndex to enumerate fields on a class.


Class_GetInterface

ClassClass * __cdecl   Class_GetInterface(ClassClass *cls, unsigned index);

Retrieves an interface specified by index.

Return Value:

Returns a pointer to a class interface object.

ParameterDescription
cls Address of the class object. Use FindClass to determine.
index Index value of the interface in the class. The index must be between 0 and the interface count (returned from Class_GetInterfaceCount) minus 1, inclusive.


Class_GetInterfaceCount

unsigned __cdecl            Class_GetInterfaceCount(ClassClass *cls);

Retrieves the total number of interfaces implemented by the class.

Return Value:

Returns the number of interfaces.

ParameterDescription
cls Address of the class object. Use FindClass to determine.


Class_GetMethod

struct methodblock* __cdecl Class_GetMethod(ClassClass *cls, const char *name, const char *signature);

Retrieves a handle to a method explicitly specified by name. This handle is needed to get any further information about the method.

Return Value:

Returns a method block pointer.

ParameterDescription
cls Address of the class object. Use FindClass to determine.
name Name of the method in the class.


Class_GetMethodByIndex

struct methodblock* __cdecl Class_GetMethodByIndex(ClassClass *cls, unsigned index);

Retrieves a handle to a method specified by index.

Return Value:

Returns a method block pointer.

ParameterDescription
cls Address of the class object. Use FindClass to determine.
index Index value of the method in the class. The index must be between 0 and the method count (returned from Class_GetMethodCount) minus 1, inclusive.


Class_GetMethodCount

unsigned __cdecl            Class_GetMethodCount(ClassClass *cls);

Retrieves the total number of methods in the class, including super and static methods.

Return Value:

Returns the number of methods.

ParameterDescription
cls Address of the class object. Use FindClass to determine.

Remarks:

This function is intended to be used with Class_GetMethodByIndex to enumerate methods on a class.

Note that this function returns the total count of all members, not just the count of those declared in the class specified. To find declared members, you must enumerate methods and call Member_GetClass on each to determine where the method is implemented.


Class_GetName

const char * __cdecl        Class_GetName(ClassClass *cls);

Retrieves the class name.

Return Value:

Returns class name.

ParameterDescription
cls Address of the class object.


Class_GetSuper

ClassClass * __cdecl        Class_GetSuper(ClassClass *cls);

Retrieves the superclass.

Return Value:

Returns the superclass.

ParameterDescription
cls Address of the class object.


Class_ArrayAlloc

HObject* __cdecl ClassArrayAlloc(int type, int cItems, char *szSig);

Creates an array of objects.

Return Value:

Returns an allocated object array.

ParameterDescription
type Type of objects in the array. The following types are supported:
T_BOOLEAN A Boolean object.
T_BYTE A Byte object.
T_CHAR A Character object.
T_CLASS A Class object (use szSig to specify the class).
T_DOUBLE A Double object.
T_FLOAT A Float object.
T_INT An Integer object.
T_LONG A Long object.
T_SHORT A Short object.
cItems Number of elements in the array to allocate.
szSig Signature of the class if type is T_CLASS. (For example, "java/awt/Rectangle".)


do_execute_java_method

long __cdecl do_execute_java_method(ExecEnv *ee, void *obj, char *method_name, 
        char *signature, struct methodblock *mb, bool_t isStaticCall, ...);

Calls a Java method.

Return Value:

Returns TRUE if successful, or FALSE otherwise.

ParameterDescription
ee Placeholder for execution environment, which is not needed by the Microsoft VM. This parameter should be set to NULL.
obj Object pointer.
method_name Name of the method to invoke. Set to NULL if using a method block.
signature Types of parameters passed to the constructor. See execute_java_dynamic_method for a description of signature characters. Pass NULL if using a method block.
methodblock Address of the cached method block data structure. Use get_methodblock to retrieve this. The underlying structure of the method block is not defined; it is used only to prevent accidental type misuse using the alternative, PVOID.
isStaticCall True if calling a static method, or false otherwise.

Remarks:

This is a helper function for the execute_java_static_method and execute_java_dynamic_method functions. It can be used when making repeated calls to a method to avoid the overhead of name lookup on each call. Note that invoking a Java method can cause garbage collections.

The following example demonstrates calling this function for repeated access to the Rectangle.move method:


struct {
    Hjava_awt_Rectangle *phRectangle;
} gc;

struct methodblock *pmb = get_methodblock(gc.phRectangle, "move", "(II)V");

for (i=0; i < 10; i++)
{
  do_execute_java_method(NULL, gc.phRectangle, NULL, NULL, pmb, FALSE, x, y);
}

exceptionClear

void __cdecl exceptionClear(ExecEnv *ee);

Clears any pending exceptions.

ParameterDescription
ee Placeholder for execution environment, which is not needed by the Microsoft VM. Set this parameter to NULL.


exceptionDescribe

void __cdecl exceptionDescribe(ExecEnv *ee);

Invokes printStackTrace on the pending exception.

ParameterDescription
ee Placeholder for execution environment, which is not needed by the Microsoft VM. Set this parameter to NULL.


exceptionOccurred

bool_t __cdecl exceptionOccurred(ExecEnv *ee);

Determines if an exception has occurred in the called Java method without exiting the native code.

Return Value:

Returns TRUE if an exception occurred, or FALSE otherwise.

ParameterDescription
ee Placeholder for the execution environment, which is not needed by the Microsoft VM. Set this parameter to NULL.


execute_java_constructor

HObject* __cdecl execute_java_constructor(ExecEnv *ee, char *classname, 
        ClassClass *cb, char *signature, ...);

Allocates a new Java object and invokes a constructor.

ParameterDescription
ee Placeholder for execution environment, which is not needed by the Microsoft VM. This parameter should be set to NULL.
classname Name of the class if the cb parameter is NULL. Use forward slashes (/) instead of dots as package delimiters. (For example, "java/lang/System".)
cb Address of the class object. Use NULL and provide classname if not known.
signature Types of parameters passed to the constructor. See execute_java_dynamic_method for a description of signature characters. The return type for all constructors, 'V', is automatically appended and should not be specified.


execute_java_dynamic_method

long __cdecl execute_java_dynamic_method(ExecEnv *ee, HObject *obj, char 
        *method_name, char *signature, ...);

Invokes a Java dynamic method.

ParameterDescription
ee Placeholder for the execution environment, which is not needed by the Microsoft VM. Set this parameter to NULL.
obj Address to the Java object containing method.
method_name Name of the method to be called.
signature Types of parameters and return type of the method (see below) .

Remarks:

The signature parameter specifies the parameters and return type of the method by enclosing the character codes for parameter types in parentheses, followed by the character code for the return type. The following table shows the mapping of types to signature characters:
Character Java Type
[ array
Z boolean
B byte
C char
D double
F float
I int
J long
L object
S short
V void

Arrays must be followed by the array type. For example, "[C" for a character array. For multidimensional arrays, repeat "[" for the number of dimensions. For example, "[[Z" signifies a two-dimensional boolean array.

For objects, the signature is followed by the object class name and ends with a semicolon (;). For example, the signature for the a Rectangle object is "Ljava/awt/Rectangle;"

The following example uses this function to call the Rectangle.move method with two integer parameters to the method, x and y:


long lrval = execute_java_dynamic_method(NULL, phRectangle, "move","(II)V", x, y);

execute_java_static_method

long __cdecl execute_java_static_method(ExecEnv *ee, ClassClass *cb, 
        char *method_name, char *signature, ...);

Invokes a Java static method.

ParameterDescription
ee Placeholder for execution environment, which is not needed by the Microsoft VM. Pass NULL.
cb Address of the class object. Use FindClass to obtain this.
method_name Name of the method to be called.
signature Types of parameters passed to the constructor. For a description of signature characters, see execute_java_dynamic_method.


Field_GetXXX


__int32 __cdecl             Field_GetValue(HObject *obj, struct fieldblock * field);
__int64 __cdecl             Field_GetValue64(HObject *obj, struct fieldblock * field);
float __cdecl                  Field_GetFloat(HObject *obj, struct fieldblock * field);
double __cdecl              Field_GetDouble(HObject *obj, struct fieldblock * field);
#define Field_GetBoolean(obj,field)     ((bool_t)       Field_GetValue(obj,field))
#define Field_GetByte(obj,field)        ((signed char)  Field_GetValue(obj,field))
#define Field_GetChar(obj,field)        ((unicode)      Field_GetValue(obj,field))
#define Field_GetShort(obj,field)       ((short)        Field_GetValue(obj,field))
#define Field_GetInt(obj,field)                         Field_GetValue(obj,field)
#define Field_GetLong(obj,field)                        Field_GetValue64(obj,field)
#define Field_GetObject(obj,field)      ((HObject*)     Field_GetValue(obj,field))
#define Field_GetFloat(obj,field)                       Field_GetFloat(obj,field)
#define Field_GetDouble(obj,field)                      Field_GetDouble(obj,field)

Retrieves the value of the specified field.

Return Value:

Returns a value of a type determined by the function.

ParameterDescription
obj Address of the object that the field belongs to.
field Field block of the field.

Remarks:

These functions operate on static or non-static fields, including both of the component object model (COM) MapsTo fields and the fields in Java objects.


Field_GetOffset

unsigned __cdecl Field_GetOffset(struct fieldblock * field);

Returns the offset of dynamic fields in the class.

Return Value:

Returns the offset of the field relative to the object for non-static fields. Returns 0 for static fields.

ParameterDescription
field Field block of the field. The underlying structure of field block is not defined; it is used only to prevent accidental type misuse using the alternative, PVOID.

Remarks:

Note that this function accounts for the 'MSReserved' value at the top of structures generated by msjavah. This means you can just add this value to the base of the object to get to the data.


Field_GetStaticPtr

PVOID __cdecl  Field_GetStaticPtr(struct fieldblock * field);

Returns an address of the static data.

Return Value:

Returns an address to the data for static fields, or NULL for non-static fields.

ParameterDescription
field Field block of the field. The underlying structure of field block is not defined; it is used only to prevent accidental type misuse using the alternative, PVOID.


Field_SetXXX


void __cdecl                Field_SetValue(HObject *obj, struct fieldblock * field, __int32 value);
void __cdecl                Field_SetValue64(HObject *obj, struct fieldblock * field, __int64 value);
void __cdecl                Field_SetFloat(HObject *obj, struct fieldblock * field, float value);
void __cdecl                Field_SetDouble(HObject *obj, struct fieldblock * field, double value);
#define Field_SetBoolean(obj,field,value)               Field_SetValue(obj,field,(bool_t)(value))
#define Field_SetByte(obj,field,value)                  Field_SetValue(obj,field,(signed char)(value))
#define Field_SetChar(obj,field,value)                  Field_SetValue(obj,field,(unicode)(value))
#define Field_SetShort(obj,field,value)                 Field_SetValue(obj,field,(short)(value))
#define Field_SetInt(obj,field,value)                   Field_SetValue(obj,field,value)
#define Field_SetLong(obj,field,value)                  Field_SetValue64(obj,field,value)
#define Field_SetObject(obj,field,value)                Field_SetValue(obj,field,(__int32)(value))
#define Field_SetFloat(obj,field,value)                 Field_SetFloat(obj,field,value)
#define Field_SetDouble(obj,field,value)                Field_SetDouble(obj,field,value)

Sets the value of the specified field.

ParameterDescription
obj Address of the object that the field belongs to.
field Field block of the field.

Remarks:

These functions operate on static or non-static fields, including both of the COM MapsTo fields and the fields in Java objects.


FindClass

ClassClass* __cdecl FindClass(ExecEnv *ee, char *classname, bool_t resolve);

Retrieves a class object pointer for a named class.

Return Value:

Returns a pointer to the class.

ParameterDescription
ee Placeholder for execution environment, which is not needed by the Microsoft VM. Set this parameter to NULL.
classname Name of the class to locate.
resolve Ignored. Classes found will always be ignored.

Remarks:

Use this function to get a pointer to a class, named by classname. This pointer can be used in the execute_java_static_method function to identify the class.


GCDisable

int     __cdecl GCDisable();

Increments the block count and disables garbage collection.

Return Value:

Returns TRUE if successful, or FALSE otherwise.

Remarks:

Use this function to disable garbage collection after you have enabled it using GCEnable.


GCDisableCount

int     __cdecl GCDisableCount();

Disables the counting used by GCEnable and GCDisable.

Return Value:

Returns the current count.

Remarks:

Used for diagnostic purposes. Since the use of GCEnable and GCDisable requires a counter, this provides a way to verify that the count is what is expected.


GCDisableMultiple

void    __cdecl GCDisableMultiple(int cDisable);

Increments the block count a specified number of times.

ParameterDescription
cDisable Number of times to increment the block count.

Remarks:

This function is useful when you have previously called GCEnableCompletely to allow garbage collection on all referenced objects, but later want to reinstate the block count with one call. The following example shows enabling garbage collection around a sleep call.


    int nEnable = GCEnableCompletely();
    Sleep( (int) millis );
    GCDisableMultiple(nEnable);

GCEnable

int     __cdecl GCEnable();

Decrements the block count and enables garbage collection by the VM.

Return Value:

Returns TRUE if successful, or FALSE otherwise.

Remarks:

When calling a native function from within Java, garbage collection is blocked by default. If the native function call is going to take some time, you can enable garbage collection with this call. However, you should first use the GCFramePush function to allow the garbage collector to track any Java objects that you care about during garbage collection.


GCEnableCompletely

int     __cdecl GCEnableCompletely();

Decrements the block count to 0 and enables garbage collection by the VM.

Return Value:

Returns the block count before entering this function.

Remarks:

This function enables garbage collection, regardless of the number of calls previously made to GCDisable, incrementing the block count.


GCFramePop

void    __cdecl GCFramePop(PVOID pGCFrame);

Restores the GCFrame with current values for members of the structure.

ParameterDescription
pGCFrame Address of a garbage collection frame that references a structure with Java objects that are being tracked.


GCFramePush

void    __cdecl GCFramePush(PVOID pGCFrame, PVOID pObjects, 
                DWORD cbObjectStructSize);

Informs the VM garbage collector of a GCFrame to track.

ParameterDescription
pGCFrame Address of a garbage collection frame referencing the pObjects structure.
pObjects Structure containing the Java objects to track during garbage collection.
cbObjectStructSize Size of pObjects structure.

Remarks:

The garbage collector initializes the structure referenced by pObjects to NULL.


GCFreeHandle

void __cdecl GCFreeHandle(HObject **pphobj);

Frees a strong pointer, originally obtained using GCNewHandle.

ParameterDescription
pphobj Pointer to be freed.


GCFreePtr

void    __cdecl GCFreePtr(HObject **pphobj);

Frees a garbage collection pointer originally obtained using GCGetPtr.

ParameterDescription
pphobj Pointer to be freed.


GCGetPtr

HObject** __cdecl GCGetPtr(HObject *phobj);

Allocates a "weak" pointer for an object, and then updates it when garbage collection occurs.

Return Value:

Returns an address to a pointer to a Java object handle.

ParameterDescription
phobj Address of a Java object.

Remarks:

Given a pointer to an object, this function allocates and returns the address of that object pointer, and then updates the contained pointer when GC occurs. Note that if the object gets freed during GC, the value of the contained pointer will be null. A "weak" pointer is different from a "strong" pointer (as allocated by GCNewHandle). A weak pointer will not block garbage collection (removal) of the referenced object, but a strong pointer will. (Strong pointers are scanned like any other object during GC; weak pointers are updated after the GC has been completed.)


GCNewHandle

HObject** __cdecl GCNewHandle(HObject *phobj);

Creates a "strong pointer" to an object.

Return Value:

Returns an address to the object pointer.

ParameterDescription
phobj Object that is be referenced.

Remarks:

Using this function is similar to placing an object in a GCFrame; however, strong pointers can be stored statically across calls. A strong pointer prevents the object from being collected as garbage, whereas a weak pointer only tracks the object's movement.


get_methodblock

struct methodblock* __cdecl get_methodblock(HObject *pjobj, char *method_name, 
        char *signature);

Retrieves a pointer to a method block structure containing the class name, method name, and parameter and return types of a method.

Return Value:

Returns the method block pointer. This is useful for functions like do_execute_java_method, which can use this information directly instead of having to look it up.

ParameterDescription
pjobj Address of the structure.
method_name Name of the method to invoke.
signature Types of parameters passed to the constructor. For a description of signature characters, see execute_java_dynamic_method.


isInstanceOf

BOOL __cdecl isInstanceOf(JHandle *phobj, char *classname);

Determines if a specified Java object is an instance of a particular class.

Return Value:

Returns TRUE if the handle is an instance of the class, or FALSE otherwise.

ParameterDescription
pohobj Address of the Java handle.
classname Name of the Java class.


javaString2CString

char* __cdecl javaString2CString(Hjava_lang_String *s, char *buf, int buflen);

Retrieves the characters of the Java String object into a C string buffer.

Return Value:

Returns the address of the C string.

ParameterDescription
s Java String object.
buf C string buffer.
buflen Length of the C string buffer.

Remarks:

Use this function in place of the JDK makeCString function which is unsupported by the Microsoft Raw Native Interface. No allocation occurs with his function.


javaStringLength

int __cdecl javaStringLength(Hjava_lang_String *s);

Retrieves the length of the Java String object.

Return Value:

Returns the number of characters in the string.

ParameterDescription
s Java String object.


jio_snprintf

int __cdecl jio_snprintf(char *str, size_t count, const char *fmt, ...);

Prints to a string with a buffer limit.

Return Value:

Returns the length of the string after printing to it.

ParameterDescription
str String to print to.
count Limit of the number of characters to print.
fmt Format string (see sprintf).


jio_vsnprintf

int __cdecl jio_vsnprintf(char *str, size_t count, const char *fmt, va_list  args);

Prints to a string with a buffer limit using a va_list macro for arguments.

Return Value:

Returns the length of the string after printing to it.

ParameterDescription
str String to print to.
count Limit of the number of characters to print.
fmt Format string (see sprintf).
args Argument list.


makeJavaString

Hjava_lang_String* __cdecl makeJavaString(char *str, int len);

Creates a new Java String object, initialized from the C string.

Return Value:

Returns a string formatted as a Java String object.

ParameterDescription
str C string to convert.
len Number of characters in the C string, excluding the terminating NULL.


makeJavaStringW

Hjava_lang_String* __cdecl makeJavaStringW( unicode *pszwSrc, int cch );

Constructs a Java string from a Unicode C string.

Return Value:

Returns a string formatted as a Java String object.

ParameterDescription
pszwSrc C string to convert.
cch Number of characters in the C string, excluding the terminating NULL.


MakeByteString

HArrayOfByte* __cdecl MakeByteString(char *str, long len);

Creates a new array of bytes initialized from the C string.

Return Value:

Returns the converted byte string.

ParameterDescription
str C string to convert.
len Number characters in the string, excluding the terminating NULL character.


Member_GetAttributes

int __cdecl   Member_GetAttributes(PVOID member);

Retrieves a combination of the ACC_XXX flags for a field or method, as appears in the Java class file.

Return Value:

Returns attributes flags.

ParameterDescription
member Method or field block of the member.


Member_GetClass

ClassClass * __cdecl  Member_GetClass(PVOID member);

Retrieves the name of the class that the field or method is implemented in.

Return Value:

Returns the name of a class.

ParameterDescription
member Address of a method or field block.


Member_GetName

const char * __cdecl        Member_GetName(PVOID member);

Retrieves the method or field name.

Return Value:

Returns the method or field name.

ParameterDescription
member Address of a method or field block.


Member_GetSignature

const char * __cdecl        Member_GetSignature(PVOID member);

Retrieves the signature of the field or method.

Return Value:

Returns a signature.

ParameterDescription
member Address of a method or field block.


Object_GetClass

ClassClass * __cdecl    Object_GetClass(HObject *obj);

Retrieves class that the object points to.

Return Value:

Returns a class object pointer.

ParameterDescription
obj Class object to retrieve.


SignalError

void __cdecl SignalError(struct execenv *ee, char *ename, char *DetailMessage);

Creates a Java exception object, which is thrown upon returning from the native code.

ParameterDescription
ee Placeholder for executive environment, which is not needed. This parameter should be NULL.
ename Name of a valid Throwable exception class or subclass.
DetailMessage Message to display with the exception. Can be set to NULL.


SignalErrorPrintf

void __cdecl SignalErrorPrintf( char *ename, char *pszFormat, ...);

Creates a Java exception object and specifies a format string for exception description to be printed when thrown.

ParameterDescription
ename Name of a valid Throwable exception class or subclass.
pszFormat Format string. See C printf function.



Top© 1997 Microsoft Corporation. All rights reserved. Terms of Use.