Home about services products contact login
   com.smardec

J2Native

  j2native
com.smardec.j2native
Class Function

java.lang.Object
|
+--com.smardec.j2native.Function

public class Function
extends java.lang.Object

Function class is Java representation of the native function. This class is used to call native function. In dependence of native method calling convention, stack will be arranged in different ways. So, be sure you exactly know calling convention of native method.

See Also:
Library, Argument

Field Summary
static byte ARGUMENT_DEFINED_RESULTING_MECHANIZM
Mechanizm of the returning result will be defined by returning argument, it is default behaviour of the function
static byte CDECL_CALLING_CONVENTION
CDECL calling convention
static byte DEFAULT_CALLING_CONVENTION
System default calling convention
static byte FLOAT_VALUE_RESULTING_MECHANIZM
Result value of the function will be stored in the FP0 FPU register.
static byte FORCED_STANDART_RESULTING_MECHANIZM
Despite of returning mechanizm setted by return argument, standart way of obtaining function result will be used.
static byte PASCAL_CALLING_CONVENTION
PASCAL calling convention
static byte STDCALL_CALLING_CONVENTION
STDCALL calling convention
Constructor Summary
Function(long address, byte callingConvention)
Creates new Function.
Function(long address, byte callingConvention, java.lang.String functionName)
Creates new Function.
Method Summary
static void call(java.lang.String libraryName, java.lang.String functionName, Argument returnValue)
Loads Library, specified by it's name, locates within it specified function, passes arguments to this function and then invokes it.
static void call(java.lang.String libraryName, java.lang.String functionName, Argument returnValue, Argument argument)
Loads Library, specified by it's name, locates within it specified function, passes arguments to this function and then invokes it.
static void call(java.lang.String libraryName, java.lang.String functionName, Argument returnValue, Argument[] arguments)
Loads Library, specified by it's name, locates within it specified function, passes arguments to this function and then invokes it.
static void call(java.lang.String libraryName, java.lang.String functionName, Argument returnValue, Argument argument1, Argument argument2)
Loads Library, specified by it's name, locates within it specified function, passes arguments to this function and then invokes it.
static void call(java.lang.String libraryName, java.lang.String functionName, Argument returnValue, Argument argument1, Argument argument2, Argument argument3)
Loads Library, specified by it's name, locates within it specified function, passes arguments to this function and then invokes it.
static void call(java.lang.String libraryName, java.lang.String functionName, Argument returnValue, Argument argument1, Argument argument2, Argument argument3, Argument argument4)
Loads Library, specified by it's name, locates within it specified function, passes arguments to this function and then invokes it.
byte getCallingConvention()
Returns function calling convention.
java.lang.String getName()
Returns name of the function.
byte getReturnFlags()
Function return value mechanizm.
void invoke(Argument returnValue)
Invokes native function, that associate with this Function instance.
void invoke(Argument returnValue, Argument argument)
Invokes native function, that associate with this Function instance.
void invoke(Argument returnValue, Argument[] arguments)
Invokes native function, that associate with this Function instance.
void invoke(Argument returnValue, Argument argument1, Argument argument2)
Invokes native function, that associate with this Function instance.
void invoke(Argument returnValue, Argument argument1, Argument argument2, Argument argument3)
Invokes native function, that associate with this Function instance.
void invoke(Argument returnValue, Argument argument1, Argument argument2, Argument argument3, Argument argument4)
Invokes native function, that associate with this Function instance.
void setCallingConvention(byte callingConvention)
Sets function calling convention.
void setReturnFlags(byte returnFlags)
In most cases this method will be never used, because return value Argument wrapper fully describes behaviour of the native function.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail
CDECL_CALLING_CONVENTION
public static final byte CDECL_CALLING_CONVENTION

CDECL calling convention

See Also:
Constant Field Values

STDCALL_CALLING_CONVENTION
public static final byte STDCALL_CALLING_CONVENTION
STDCALL calling convention

See Also:
Constant Field Values

PASCAL_CALLING_CONVENTION
public static final byte PASCAL_CALLING_CONVENTION
PASCAL calling convention

See Also:
Constant Field Values

DEFAULT_CALLING_CONVENTION
public static final byte DEFAULT_CALLING_CONVENTION
System default calling convention


FORCED_STANDART_RESULTING_MECHANIZM
public static final byte FORCED_STANDART_RESULTING_MECHANIZM
Despite of returning mechanizm setted by return argument, standart way of obtaining function result will be used. This means that the return value of the native function is stored in EDX:EAX registers pair.

See Also:
Constant Field Values

ARGUMENT_DEFINED_RESULTING_MECHANIZM
public static final byte ARGUMENT_DEFINED_RESULTING_MECHANIZM
Mechanizm of the returning result will be defined by returning argument, it is default behaviour of the function

See Also:
Constant Field Values

FLOAT_VALUE_RESULTING_MECHANIZM
public static final byte FLOAT_VALUE_RESULTING_MECHANIZM
Result value of the function will be stored in the FP0 FPU register.

See Also:
Constant Field Values
Constructor Detail
Function
public Function(long address, byte callingConvention)
Creates new Function.

Parameters:
address - entry point for native function
callingConvention - calling convention of the function

Function
public Function(long address, byte callingConvention, java.lang.String functionName)
Creates new Function.

Parameters:
address - entry point for native function
callingConvention - calling convention of the function
functionName - custom function name
Method Detail
getCallingConvention
public byte getCallingConvention()
Returns function calling convention.

Returns:
calling convention.

setCallingConvention
public void setCallingConvention(byte callingConvention)
Sets function calling convention.

Parameters:
callingConvention - calling convention

getReturnFlags
public byte getReturnFlags()
Function return value mechanizm.

Returns:
return value flag.

setReturnFlags
public void setReturnFlags(byte returnFlags)
In most cases this method will be never used, because return value Argument wrapper fully describes behaviour of the native function. But sometimes native libraries are compiled with some keys, that change function default behaviour. So you need this method to set appropriate flag to define correct interaction with the such function.

Parameters:
returnFlags -

getName
public java.lang.String getName()
Returns name of the function.

Returns:
function name.

invoke
public void invoke(Argument returnValue, Argument[] arguments) throws FunctionExecutionException
Invokes native function, that associate with this Function instance. You have to provide exactly type of the return value parameter. If native function have no return value, null is a valid.

Parameters:
returnValue - native return value representation in Java
arguments - array of Argument parameters, that should be passed to native function
Throws:
FunctionExecutionException - if something goes wrong

invoke
public final void invoke(Argument returnValue) throws FunctionExecutionException
Invokes native function, that associate with this Function instance. You have to provide exactly type of the return value parameter. If native function have no return value, null is a valid. This method is used for no parameters native functions only.

Parameters:
returnValue - native return value representation in Java
Throws:
FunctionExecutionException - if something goes wrong

invoke
public final void invoke(Argument returnValue, Argument argument) throws FunctionExecutionException
Invokes native function, that associate with this Function instance. You have to provide exactly type of the return value parameter. If native function have no return value, null is a valid. This method is used for one parameter native functions only.

Parameters:
returnValue - native return value representation in Java
argument - Argument parameter, that should be passed to native function
Throws:
FunctionExecutionException - if something goes wrong

invoke
public final void invoke(Argument returnValue, Argument argument1, Argument argument2) throws FunctionExecutionException
Invokes native function, that associate with this Function instance. You have to provide exactly type of the return value parameter. If native function have no return value, null is a valid. This method is used for two parameters native functions only.

Parameters:
returnValue - native return value representation in Java
argument1 - first Argument parameter, that should be passed to native function
argument2 - second Argument parameter, that should be passed to native function
Throws:
FunctionExecutionException - if something goes wrong

invoke
public final void invoke(Argument returnValue, Argument argument1, Argument argument2, Argument argument3) throws FunctionExecutionException
Invokes native function, that associate with this Function instance. You have to provide exactly type of the return value parameter. If native function have no return value, null is a valid. This method is used for three parameters native functions only.

Parameters:
returnValue - native return value representation in Java
argument1 - first Argument parameter, that should be passed to native function
argument2 - second Argument parameter, that should be passed to native function
argument3 - third Argument parameter, that should be passed to native function
Throws:
FunctionExecutionException - if something goes wrong

invoke
public final void invoke(Argument returnValue, Argument argument1, Argument argument2, Argument argument3, Argument argument4) throws FunctionExecutionException
Invokes native function, that associate with this Function instance. You have to provide exactly type of the return value parameter. If native function have no return value, null is a valid. This method is used for four parameters native functions only.

Parameters:
returnValue - native return value representation in Java
argument1 - first Argument parameter, that should be passed to native function
argument2 - second Argument parameter, that should be passed to native function
argument3 - third Argument parameter, that should be passed to native function
argument4 - forth Argument parameter, that should be passed to native function
Throws:
FunctionExecutionException - if something goes wrong

call
public static void call(java.lang.String libraryName, java.lang.String functionName, Argument returnValue, Argument[] arguments) throws FunctionExecutionException
Loads Library, specified by it's name, locates within it specified function, passes arguments to this function and then invokes it. You have to provide exactly type of the return value parameter. If native function have no return value, null is a valid.

Parameters:
libraryName - name of the Library, from which function will be loaded
functionName - name of the function
returnValue - native return value representation in Java
arguments - array of Argument parameters, that should be passed to native function
Throws:
FunctionExecutionException - if something goes wrong

call
public static final void call(java.lang.String libraryName, java.lang.String functionName, Argument returnValue) throws FunctionExecutionException
Loads Library, specified by it's name, locates within it specified function, passes arguments to this function and then invokes it. You have to provide exactly type of the return value parameter. If native function have no return value, null is a valid. This method is used for no parameters native functions only.

Parameters:
libraryName - name of the Library, from which function will be loaded
functionName - name of the function
returnValue - native return value representation in Java
Throws:
FunctionExecutionException - if something goes wrong

call
public static final void call(java.lang.String libraryName, java.lang.String functionName, Argument returnValue, Argument argument) throws FunctionExecutionException
Loads Library, specified by it's name, locates within it specified function, passes arguments to this function and then invokes it. You have to provide exactly type of the return value parameter. If native function have no return value, null is a valid. This method is used for one parameter native functions only.

Parameters:
libraryName - name of the Library, from which function will be loaded
functionName - name of the function
returnValue - native return value representation in Java
argument - Argument parameter, that should be passed to native function
Throws:
FunctionExecutionException - if something goes wrong

call
public static final void call(java.lang.String libraryName, java.lang.String functionName, Argument returnValue, Argument argument1, Argument argument2) throws FunctionExecutionException
Loads Library, specified by it's name, locates within it specified function, passes arguments to this function and then invokes it. You have to provide exactly type of the return value parameter. If native function have no return value, null is a valid. This method is used for two parameters native functions only.

Parameters:
libraryName - name of the Library, from which function will be loaded
functionName - name of the function
returnValue - native return value representation in Java
argument1 - first Argument parameter, that should be passed to native function
argument2 - second Argument parameter, that should be passed to native function
Throws:
FunctionExecutionException - if something goes wrong

call
public static final void call(java.lang.String libraryName, java.lang.String functionName, Argument returnValue, Argument argument1, Argument argument2, Argument argument3) throws FunctionExecutionException
Loads Library, specified by it's name, locates within it specified function, passes arguments to this function and then invokes it. You have to provide exactly type of the return value parameter. If native function have no return value, null is a valid. This method is used for three parameters native functions only.

Parameters:
libraryName - name of the Library, from which function will be loaded
functionName - name of the function
returnValue - native return value representation in Java
argument1 - first Argument parameter, that should be passed to native function
argument2 - second Argument parameter, that should be passed to native function
argument3 - third Argument parameter, that should be passed to native function
Throws:
FunctionExecutionException - if something goes wrong

call
public static final void call(java.lang.String libraryName, java.lang.String functionName, Argument returnValue, Argument argument1, Argument argument2, Argument argument3, Argument argument4) throws FunctionExecutionException
Loads Library, specified by it's name, locates within it specified function, passes arguments to this function and then invokes it. You have to provide exactly type of the return value parameter. If native function have no return value, null is a valid. This method is used for four parameters native functions only.

Parameters:
libraryName - name of the Library, from which function will be loaded
functionName - name of the function
returnValue - native return value representation in Java
argument1 - first Argument parameter, that should be passed to native function
argument2 - second Argument parameter, that should be passed to native function
argument3 - third Argument parameter, that should be passed to native function
argument4 - forth Argument parameter, that should be passed to native function
Throws:
FunctionExecutionException - if something goes wrong
Home about services products contact login