public class Function
extends java.lang.Object
Function class allows to call a specified function
from a native code library.| Modifier and Type | Field and Description |
|---|---|
static byte |
CDECL_CALLING_CONVENTION
Indicates cdecl calling convention.
|
static byte |
DEFAULT_CALLING_CONVENTION
Default calling convention for native platform.
|
static com.jniwrapper.NullLibrary |
NULL_LIBRARY |
static byte |
STDCALL_CALLING_CONVENTION
Indicates stdcall calling convention.
|
| Modifier and Type | Method and Description |
|---|---|
static long |
call(java.lang.String libraryName,
java.lang.String functionName,
Parameter returnValue)
Convenience method that invokes a native code function, which has no parameters.
|
static long |
call(java.lang.String libraryName,
java.lang.String functionName,
Parameter returnValue,
Parameter parameter)
Convenience method that invokes a native code function with a single parameter.
|
static long |
call(java.lang.String libraryName,
java.lang.String functionName,
Parameter returnValue,
Parameter[] parameters)
Invokes the specified function from a specified native library.
|
static long |
call(java.lang.String libraryName,
java.lang.String functionName,
Parameter returnValue,
Parameter param1,
Parameter param2)
Convenience method that invokes a native code function, which has two parameters.
|
static long |
call(java.lang.String libraryName,
java.lang.String functionName,
Parameter returnValue,
Parameter param1,
Parameter param2,
Parameter param3)
Convenience method that invokes a native function with three parameters.
|
static long |
call(java.lang.String libraryName,
java.lang.String functionName,
Parameter returnValue,
Parameter param1,
Parameter param2,
Parameter param3,
Parameter param4)
Convenience method that invokes a native function with four parameters.
|
byte |
getCallingConvention()
Returns calling convention used for calling this function.
|
java.lang.String |
getName()
Returns function name.
|
long |
invoke(Parameter returnValue)
Convenience method for calling a native function without parameters.
|
long |
invoke(Parameter returnValue,
Parameter parameter)
Convenience method for calling a native function with a single parameter.
|
long |
invoke(Parameter returnValue,
Parameter[] parameters)
Invokes the function with the passed parameters.
|
long |
invoke(Parameter returnValue,
Parameter param1,
Parameter param2)
Convenience method for calling native function with two parameters.
|
long |
invoke(Parameter returnValue,
Parameter param1,
Parameter param2,
Parameter param3)
Convenience method for calling a native function with three parameters.
|
long |
invoke(Parameter returnValue,
Parameter param1,
Parameter param2,
Parameter param3,
Parameter param4)
Convenience method for calling native function with four parameters.
|
void |
setCallingConvention(byte callingConvention)
Sets calling convention for this function.
|
public static final byte DEFAULT_CALLING_CONVENTION
public static final byte CDECL_CALLING_CONVENTION
public static final byte STDCALL_CALLING_CONVENTION
public static final com.jniwrapper.NullLibrary NULL_LIBRARY
public final void setCallingConvention(byte callingConvention)
Function object only - it is not mapped to the function name.
Most of the time users do not need to use this method.public byte getCallingConvention()
DEFAULT_CALLING_CONVENTION value.public java.lang.String getName()
public long invoke(Parameter returnValue, Parameter[] parameters) throws FunctionExecutionException
returnValue - reference to return valueparameters - array of parameters of called functionFunctionExecutionExceptionpublic final long invoke(Parameter returnValue) throws FunctionExecutionException
FunctionExecutionExceptioninvoke(Parameter, Parameter[])public final long invoke(Parameter returnValue, Parameter parameter) throws FunctionExecutionException
FunctionExecutionExceptioninvoke(Parameter, Parameter[])public final long invoke(Parameter returnValue, Parameter param1, Parameter param2) throws FunctionExecutionException
FunctionExecutionExceptioninvoke(Parameter, Parameter[])public final long invoke(Parameter returnValue, Parameter param1, Parameter param2, Parameter param3) throws FunctionExecutionException
FunctionExecutionExceptioninvoke(Parameter, Parameter[])public final long invoke(Parameter returnValue, Parameter param1, Parameter param2, Parameter param3, Parameter param4) throws FunctionExecutionException
FunctionExecutionExceptioninvoke(Parameter, Parameter[])public static long call(java.lang.String libraryName,
java.lang.String functionName,
Parameter returnValue,
Parameter[] parameters)
throws FunctionExecutionException
Since this method creates instances of Library
and Function, it should be used when the
number of calls is minimal.
libraryName - filename of the library containing a called functionfunctionName - name of the called functionreturnValue - reference to a return valueparameters - array of parameters of the called functionFunctionExecutionExceptionpublic static final long call(java.lang.String libraryName,
java.lang.String functionName,
Parameter returnValue)
throws FunctionExecutionException
FunctionExecutionExceptioncall(String, String, Parameter, Parameter[])public static final long call(java.lang.String libraryName,
java.lang.String functionName,
Parameter returnValue,
Parameter parameter)
throws FunctionExecutionException
FunctionExecutionExceptioncall(String, String, Parameter, Parameter[])public static final long call(java.lang.String libraryName,
java.lang.String functionName,
Parameter returnValue,
Parameter param1,
Parameter param2)
throws FunctionExecutionException
FunctionExecutionExceptioncall(String, String, Parameter, Parameter[])public static final long call(java.lang.String libraryName,
java.lang.String functionName,
Parameter returnValue,
Parameter param1,
Parameter param2,
Parameter param3)
throws FunctionExecutionException
FunctionExecutionExceptioncall(String, String, Parameter, Parameter[])public static final long call(java.lang.String libraryName,
java.lang.String functionName,
Parameter returnValue,
Parameter param1,
Parameter param2,
Parameter param3,
Parameter param4)
throws FunctionExecutionException
FunctionExecutionExceptioncall(String, String, Parameter, Parameter[])