Package de.intarsys.nativec.api
Interface INativeInterface
public interface INativeInterface
The abstraction of a generic interface to c native code.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddSearchPath(String path) Add a directory to the search path.allocate(int size) Allocate c memory and return the respectiveINativeHandle.createCallback(ICallback callback) createFunction(long address) Create anINativeFunctionfrom a function pointer.createFunction(long address, Object callingConvention) createHandle(long address) Create a voidINativeHandleto a memory address.createLibrary(String name) Load a newINativeLibrary.createLibrary(String name, Object callingConvention) Load a newINativeLibrary.intlongSize()The platform long size.intThe platform pointer size.intThe platform wide char size.
-
Method Details
-
addSearchPath
Add a directory to the search path.- Parameters:
path- The path to be added;
-
allocate
Allocate c memory and return the respectiveINativeHandle.- Parameters:
size- The size in bytes.- Returns:
- The new allocated
INativeHandle
-
createCallback
-
createFunction
Create anINativeFunctionfrom a function pointer.There is no special handling for the 0 address!
- Parameters:
address- The function pointer.- Returns:
- The function object.
-
createFunction
-
createHandle
Create a voidINativeHandleto a memory address.There is no special handling for the 0 address!
- Parameters:
address- The memory address.- Returns:
- The handle to the memory address.
-
createLibrary
Load a newINativeLibrary.- Parameters:
name- The name of the library to load.- Returns:
- The new
INativeLibrary
-
createLibrary
Load a newINativeLibrary.- Parameters:
name- The name of the library to load.callingConvention- The calling convention to use as default for functions in this library.- Returns:
- The new
INativeLibrary
-
longSize
int longSize()The platform long size.- Returns:
- The platform long size.
-
pointerSize
int pointerSize()The platform pointer size.- Returns:
- The platform pointer size.
-
wideCharSize
int wideCharSize()The platform wide char size.- Returns:
- The platform wide char size.
-