|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--CPointer | +--CFunction
An abstraction for a C function pointer. An instance of
CFunction
repesents a pointer to some C function. callXXX
methods
provide means to call the function; select a XXX
variant based
on the return type of the C function.
Beware that the copyIn
, copyOut
,
setXXX
, and getXXX
methods inherited from the
parent will indirect machine code.
CPointer
Fields inherited from class CPointer |
peer,
SIZE |
Constructor Summary | |
CFunction(CPointer ptr,
java.lang.String conv)
Create a new CFunction from a function pointer. |
|
CFunction(java.lang.String lib,
java.lang.String fname)
Create a new CFunction that is linked with a C function
that follows the standard "C" calling convention. |
|
CFunction(java.lang.String lib,
java.lang.String fname,
java.lang.String conv)
Create a new CFunction that is linked with a C function
that follows a given calling convention. |
Method Summary | |
CPointer |
callCPointer(java.lang.Object[] args)
Call the C function being represented by this object. |
double |
callDouble(java.lang.Object[] args)
Call the C function being represented by this object. |
float |
callFloat(java.lang.Object[] args)
Call the C function being represented by this object. |
int |
callInt(java.lang.Object[] args)
Call the C function being represented by this object. |
void |
callVoid(java.lang.Object[] args)
Call the C function being represented by this object. |
Methods inherited from class CPointer |
copyIn,
copyIn,
copyIn,
copyIn,
copyIn,
copyIn,
copyIn,
copyOut,
copyOut,
copyOut,
copyOut,
copyOut,
copyOut,
copyOut,
equals,
getByte,
getCPointer,
getDouble,
getFloat,
getInt,
getLong,
getShort,
getString,
hashCode,
setByte,
setCPointer,
setDouble,
setFloat,
setInt,
setLong,
setShort,
setString |
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public CFunction(java.lang.String lib, java.lang.String fname, java.lang.String conv)
CFunction
that 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.
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 ("C" or "JNI")public CFunction(java.lang.String lib, java.lang.String fname)
CFunction
that 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.
lib
- library in which to find the C functionfname
- name of the C function to be linked withpublic CFunction(CPointer ptr, java.lang.String conv)
CFunction
from a function pointer.
ptr
- the function pointerconv
- calling convention ("C" or "JNI")Method Detail |
public int callInt(java.lang.Object[] args)
args
- arguments to pass to the C functionint
value returned by the underlying
C functionpublic void callVoid(java.lang.Object[] args)
args
- arguments to pass to the C functionpublic float callFloat(java.lang.Object[] args)
args
- arguments to pass to the C functionfloat
value returned by the underlying
C functionpublic double callDouble(java.lang.Object[] args)
args
- arguments to pass to the C functiondouble
value returned by the underlying
C functionpublic CPointer callCPointer(java.lang.Object[] args)
args
- arguments to pass to the C function
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |