Package de.intarsys.nativec.jna
Class JnaNativeInterface
java.lang.Object
de.intarsys.nativec.jna.JnaNativeInterface
- All Implemented Interfaces:
INativeInterface
An
INativeInterface implemented using JNA, a LGPL licensed Java
native interface abstraction.
In our point of view, JNA has the power of deploying all what we wanted to have, but is ill designed in some key hot spots - so we worked around and built on top of our own interfaces.
-
Constructor Summary
Constructors -
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.protected com.sun.jna.PointercreateMemory(int size) intlongSize()The platform long size.intThe platform pointer size.intThe platform wide char size.
-
Constructor Details
-
JnaNativeInterface
public JnaNativeInterface()
-
-
Method Details
-
addSearchPath
Description copied from interface:INativeInterfaceAdd a directory to the search path.- Specified by:
addSearchPathin interfaceINativeInterface- Parameters:
path- The path to be added;
-
allocate
Description copied from interface:INativeInterfaceAllocate c memory and return the respectiveINativeHandle.- Specified by:
allocatein interfaceINativeInterface- Parameters:
size- The size in bytes.- Returns:
- The new allocated
INativeHandle
-
createCallback
- Specified by:
createCallbackin interfaceINativeInterface
-
createFunction
Description copied from interface:INativeInterfaceCreate anINativeFunctionfrom a function pointer.There is no special handling for the 0 address!
- Specified by:
createFunctionin interfaceINativeInterface- Parameters:
address- The function pointer.- Returns:
- The function object.
-
createFunction
- Specified by:
createFunctionin interfaceINativeInterface
-
createHandle
Description copied from interface:INativeInterfaceCreate a voidINativeHandleto a memory address.There is no special handling for the 0 address!
- Specified by:
createHandlein interfaceINativeInterface- Parameters:
address- The memory address.- Returns:
- The handle to the memory address.
-
createLibrary
Description copied from interface:INativeInterfaceLoad a newINativeLibrary.- Specified by:
createLibraryin interfaceINativeInterface- Parameters:
name- The name of the library to load.- Returns:
- The new
INativeLibrary
-
createLibrary
Description copied from interface:INativeInterfaceLoad a newINativeLibrary.- Specified by:
createLibraryin interfaceINativeInterface- 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
-
createMemory
protected com.sun.jna.Pointer createMemory(int size) -
getSearchPaths
-
longSize
public int longSize()Description copied from interface:INativeInterfaceThe platform long size.- Specified by:
longSizein interfaceINativeInterface- Returns:
- The platform long size.
-
pointerSize
public int pointerSize()Description copied from interface:INativeInterfaceThe platform pointer size.- Specified by:
pointerSizein interfaceINativeInterface- Returns:
- The platform pointer size.
-
wideCharSize
public int wideCharSize()Description copied from interface:INativeInterfaceThe platform wide char size.- Specified by:
wideCharSizein interfaceINativeInterface- Returns:
- The platform wide char size.
-