|
JNA API> 3.0.9 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jna.NativeLibrary
public class NativeLibrary
Provides management of native library resources. One instance of this class corresponds to a single loaded native library.
Library Search Paths A search for a given library will scan the following locations:
jna.library.path
User-customizable path
jna.platform.library.path
Platform-specific paths
Method Summary | |
---|---|
static void |
addSearchPath(String libraryName,
String path)
Add a path to search for the specified library, ahead of any system paths |
void |
dispose()
|
protected void |
finalize()
Close the library when it is no longer referenced. |
File |
getFile()
Returns the file on disk corresponding to this NativeLibrary instance. |
Function |
getFunction(String functionName)
Create a new Function that is linked with a native
function that follows the standard "C" calling convention. |
Function |
getFunction(String functionName,
int callingConvention)
Create a new @{link Function} that is linked with a native function that follows a given calling convention. |
Pointer |
getGlobalVariableAddress(String symbolName)
Look up the given global variable within this library. |
static NativeLibrary |
getInstance(String libraryName)
Returns an instance of NativeLibrary for the specified name. |
String |
getName()
Returns the simple name of this library. |
static NativeLibrary |
getProcess()
Returns an instance of NativeLibrary which refers to the current process. |
(package private) long |
getSymbolAddress(String name)
Used by the Function class to locate a symbol |
(package private) static String |
matchLibrary(String libName,
List searchPath)
matchLibrary() is very Linux specific. |
(package private) static double |
parseVersion(String ver)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static final NativeLibrary getInstance(String libraryName)
More than one name may map to the same NativeLibrary instance; only a single instance will be provided for any given unique file path.
libraryName
- The library name to load.
This can be short form (e.g. "c"),
an explicit version (e.g. "libc.so.6"), or
the full path to the library (e.g. "/lib/libc.so.6").public static final NativeLibrary getProcess()
public static final void addSearchPath(String libraryName, String path)
libraryName
- The name of the library to use the path forpath
- The path to use when trying to load the librarypublic Function getFunction(String functionName)
Function
that is linked with a native
function that follows the standard "C" calling convention.
The allocated instance represents a pointer to the named native function from the library, called with the standard "C" calling convention.
functionName
- Name of the native function to be linked with
UnsatisfiedLinkError
- if the function is not foundpublic Function getFunction(String functionName, int callingConvention)
The allocated instance represents a pointer to the named native function from the library, called with the named calling convention.
functionName
- Name of the native function to be linked withcallingConvention
- Calling convention used by the native function
UnsatisfiedLinkError
- if the function is not foundpublic Pointer getGlobalVariableAddress(String symbolName)
symbolName
-
UnsatisfiedLinkError
- if the symbol is not foundlong getSymbolAddress(String name)
UnsatisfiedLinkError
- if the symbol can't be foundpublic String toString()
toString
in class Object
public String getName()
public File getFile()
protected void finalize()
finalize
in class Object
public void dispose()
static String matchLibrary(String libName, List searchPath)
static double parseVersion(String ver)
|
JNA API> 3.0.9 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |