com.jniwrapper
Class Function

java.lang.Object
  |
  +--com.jniwrapper.Function

public class Function
extends java.lang.Object

The Function class allows to call specified function from a native code library.


Field Summary
static byte CDECL_CALLING_CONVENTION
          Constant for cdecl calling convention.
static byte DEFAULT_CALLING_CONVENTION
          Default calling convention for native platform.
static byte STDCALL_CALLING_CONVENTION
          Constant for stdcall calling convention.
 
Method Summary
static void call(java.lang.String libraryName, java.lang.String functionName, Parameter returnValue)
          Redirects a call to method call taking array of parameters.
static void call(java.lang.String libraryName, java.lang.String functionName, Parameter returnValue, Parameter parameter)
          Redirects a call to method call taking array of parameters.
static void call(java.lang.String libraryName, java.lang.String functionName, Parameter returnValue, Parameter[] parameters)
          This method provides access to specified function from specified DLL.
static void call(java.lang.String libraryName, java.lang.String functionName, Parameter returnValue, Parameter param1, Parameter param2)
          Redirects a call to method call taking array of parameters.
static void call(java.lang.String libraryName, java.lang.String functionName, Parameter returnValue, Parameter param1, Parameter param2, Parameter param3)
          Redirects a call to method call taking array of parameters.
static void call(java.lang.String libraryName, java.lang.String functionName, Parameter returnValue, Parameter param1, Parameter param2, Parameter param3, Parameter param4)
          Redirects a call to method call taking array of parameters.
 byte getCallingConvention()
          Returns calling convention.
 java.lang.String getName()
          Returns function name.
 void invoke(Parameter returnValue)
          Convenience method for calling native function.
 void invoke(Parameter returnValue, Parameter parameter)
          Convenience method for calling native function.
 void invoke(Parameter returnValue, Parameter[] parameters)
          Provides access to specified function from specified DLL.
 void invoke(Parameter returnValue, Parameter param1, Parameter param2)
          Convenience method for calling native function.
 void invoke(Parameter returnValue, Parameter param1, Parameter param2, Parameter param3)
          Convenience method for calling native function.
 void invoke(Parameter returnValue, Parameter param1, Parameter param2, Parameter param3, Parameter param4)
          Convenience method for calling native function.
 void setCallingConvention(byte callingConvention)
          Sets calling convention for this function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CALLING_CONVENTION

public static final byte DEFAULT_CALLING_CONVENTION
Default calling convention for native platform.

See Also:
Constant Field Values

CDECL_CALLING_CONVENTION

public static final byte CDECL_CALLING_CONVENTION
Constant for cdecl calling convention. Caller cleans stack in this convention.

See Also:
Constant Field Values

STDCALL_CALLING_CONVENTION

public static final byte STDCALL_CALLING_CONVENTION
Constant for stdcall calling convention. Callee cleans stack in this convention.

See Also:
Constant Field Values
Method Detail

setCallingConvention

public void setCallingConvention(byte callingConvention)
Sets calling convention for this function. This setting is remembered in the current Function object only - it is not mapped to the function name. Most of the time users do not need to use this method.


getCallingConvention

public byte getCallingConvention()
Returns calling convention. This method does not return DEFAULT_CALLING_CONVENTION value.


getName

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


invoke

public void invoke(Parameter returnValue,
                   Parameter[] parameters)
            throws FunctionExecutionException
Provides access to specified function from specified DLL. Types of return value and parameters specify actual types of return value and parameters of called function.

Parameters:
returnValue - reference to return value
parameters - array of parameters of called function
FunctionExecutionException

invoke

public final void invoke(Parameter returnValue)
                  throws FunctionExecutionException
Convenience method for calling native function.

FunctionExecutionException
See Also:
invoke(Parameter, Parameter[])

invoke

public final void invoke(Parameter returnValue,
                         Parameter parameter)
                  throws FunctionExecutionException
Convenience method for calling native function.

FunctionExecutionException
See Also:
invoke(Parameter, Parameter[])

invoke

public final void invoke(Parameter returnValue,
                         Parameter param1,
                         Parameter param2)
                  throws FunctionExecutionException
Convenience method for calling native function.

FunctionExecutionException
See Also:
invoke(Parameter, Parameter[])

invoke

public final void invoke(Parameter returnValue,
                         Parameter param1,
                         Parameter param2,
                         Parameter param3)
                  throws FunctionExecutionException
Convenience method for calling native function.

FunctionExecutionException
See Also:
invoke(Parameter, Parameter[])

invoke

public final void invoke(Parameter returnValue,
                         Parameter param1,
                         Parameter param2,
                         Parameter param3,
                         Parameter param4)
                  throws FunctionExecutionException
Convenience method for calling native function.

FunctionExecutionException
See Also:
invoke(Parameter, Parameter[])

call

public static void call(java.lang.String libraryName,
                        java.lang.String functionName,
                        Parameter returnValue,
                        Parameter[] parameters)
                 throws FunctionExecutionException
This method provides access to specified function from specified DLL.

Types of return value and parameters specify actual types of return value and parameters of called function.

Parameters:
libraryName - filename of DLL containing called function
functionName - name of called function
returnValue - reference to return value
parameters - array of parameters of called function
FunctionExecutionException

call

public static final void call(java.lang.String libraryName,
                              java.lang.String functionName,
                              Parameter returnValue)
                       throws FunctionExecutionException
Redirects a call to method call taking array of parameters.

FunctionExecutionException
See Also:
call(String, String, Parameter, Parameter[])

call

public static final void call(java.lang.String libraryName,
                              java.lang.String functionName,
                              Parameter returnValue,
                              Parameter parameter)
                       throws FunctionExecutionException
Redirects a call to method call taking array of parameters.

FunctionExecutionException
See Also:
call(String, String, Parameter, Parameter[])

call

public static final void call(java.lang.String libraryName,
                              java.lang.String functionName,
                              Parameter returnValue,
                              Parameter param1,
                              Parameter param2)
                       throws FunctionExecutionException
Redirects a call to method call taking array of parameters.

FunctionExecutionException
See Also:
call(String, String, Parameter, Parameter[])

call

public static final void call(java.lang.String libraryName,
                              java.lang.String functionName,
                              Parameter returnValue,
                              Parameter param1,
                              Parameter param2,
                              Parameter param3)
                       throws FunctionExecutionException
Redirects a call to method call taking array of parameters.

FunctionExecutionException
See Also:
call(String, String, Parameter, Parameter[])

call

public static final void call(java.lang.String libraryName,
                              java.lang.String functionName,
                              Parameter returnValue,
                              Parameter param1,
                              Parameter param2,
                              Parameter param3,
                              Parameter param4)
                       throws FunctionExecutionException
Redirects a call to method call taking array of parameters.

FunctionExecutionException
See Also:
call(String, String, Parameter, Parameter[])