com.jstatcom.engine
Class CFunc
- java.lang.Object
-
- com.jstatcom.engine.CPtr
-
- com.jstatcom.engine.CFunc
-
public final class CFunc extends CPtr
An abstraction for a C function pointer. An instance ofCFuncrepresents a pointer to some C function.callXXXmethods provide means to call the function; select axxxvariant based on the return type of the C function.Beware that the
copyIn,copyOut,setXXX, andgetXXXmethods inherited from the parent will indirect machine code.- See Also:
CPtr
-
-
Constructor Summary
Constructors Constructor and Description CFunc(java.lang.String lib, java.lang.String fname)Create a newCFuncthat is linked with a C function that follows the standard "C" calling convention.CFunc(java.lang.String lib, java.lang.String fname, java.lang.String conv)Create a newCFuncthat is linked with a C function that follows a given calling convention.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description CPtrcallCPtr(java.lang.Object[] args)Call the C function being represented by this object.doublecallDouble(java.lang.Object[] args)Call the C function being represented by this object.floatcallFloat(java.lang.Object[] args)Call the C function being represented by this object.intcallInt(java.lang.Object[] args)Call the C function being represented by this object.voidcallVoid(java.lang.Object[] args)Call the C function being represented by this object.-
Methods inherited from class com.jstatcom.engine.CPtr
copyIn, copyIn, copyIn, copyIn, copyIn, copyIn, copyIn, copyOut, copyOut, copyOut, copyOut, copyOut, copyOut, copyOut, equals, getByte, getCPtr, getDouble, getFloat, getInt, getLong, getShort, getString, hashCode, setByte, setCPtr, setDouble, setFloat, setInt, setLong, setShort, setString
-
-
-
-
Constructor Detail
-
CFunc
public CFunc(java.lang.String lib, java.lang.String fname, java.lang.String conv)Create a newCFuncthat is linked with a C function that follows a given calling convention.The allocated instance represents a pointer to the named C function from the named library, called with the named calling convention.
- Parameters:
lib- library in which to find the C functionfname- name of the C function to be linked withconv- calling convention used by the C function
-
CFunc
public CFunc(java.lang.String lib, java.lang.String fname)Create a newCFuncthat is linked with a C function that follows the standard "C" calling convention.The allocated instance represents a pointer to the named C function from the named library, called with the standard "C" calling convention.
- Parameters:
lib- library in which to find the C functionfname- name of the C function to be linked with
-
-
Method Detail
-
callInt
public int callInt(java.lang.Object[] args)
Call the C function being represented by this object.- Parameters:
args- arguments to pass to the C function- Returns:
intvalue returned by the underlying C function
-
callVoid
public void callVoid(java.lang.Object[] args)
Call the C function being represented by this object.- Parameters:
args- arguments to pass to the C function
-
callFloat
public float callFloat(java.lang.Object[] args)
Call the C function being represented by this object.- Parameters:
args- arguments to pass to the C function- Returns:
floatvalue returned by the underlying C function
-
callDouble
public double callDouble(java.lang.Object[] args)
Call the C function being represented by this object.- Parameters:
args- arguments to pass to the C function- Returns:
doublevalue returned by the underlying C function
-
callCPtr
public CPtr callCPtr(java.lang.Object[] args)
Call the C function being represented by this object.- Parameters:
args- arguments to pass to the C function- Returns:
- C pointer returned by the underlying C function
-
-
DMelt 3.0 © DataMelt by jWork.ORG