Package com.kenai.jffi
Class Library
java.lang.Object
com.kenai.jffi.Library
public final class Library
extends java.lang.Object
Represents a native library
-
Field Summary
Fields Modifier and Type Field Description static intGLOBALAll symbols in the library are made available to other librariesstatic intLAZYPerform lazy binding.static intLOCALSymbols in this library are not made available to other librariesstatic intNOWResolve all symbols when loading the library -
Method Summary
Modifier and Type Method Description protected voidfinalize()static LibrarygetCachedInstance(java.lang.String name, int flags)Gets a handle for the named library.static LibrarygetDefault()Gets a handle to the default library.static java.lang.StringgetLastError()Gets the current error string from dlopen/LoadLibrary.longgetSymbolAddress(java.lang.String name)Gets the address of a symbol within theLibrary.static LibraryopenLibrary(java.lang.String name, int flags)Gets a handle for the named library.Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
LAZY
public static final int LAZYPerform lazy binding. Only resolve symbols as needed- See Also:
- Constant Field Values
-
NOW
public static final int NOWResolve all symbols when loading the library- See Also:
- Constant Field Values
-
LOCAL
public static final int LOCALSymbols in this library are not made available to other libraries- See Also:
- Constant Field Values
-
GLOBAL
public static final int GLOBALAll symbols in the library are made available to other libraries- See Also:
- Constant Field Values
-
-
Method Details
-
getDefault
Gets a handle to the default library.- Returns:
- A
Libraryinstance representing the default library.
-
getCachedInstance
Gets a handle for the named library.- Parameters:
name- The name or path of the library to open.flags- The library flags (e.g.LAZY, NOW, LOCAL, GLOBAL)- Returns:
- A
Libraryinstance representing the named library, ornullif the library could not be opened.
-
openLibrary
Gets a handle for the named library. Note This will not cache the instance, nor will it return a cached instance. Only use when you really need a new handle for the library.- Parameters:
name- The name or path of the library to open.flags- The library flags (e.g.LAZY, NOW, LOCAL, GLOBAL)- Returns:
- A
Libraryinstance representing the named library, or null if the library cannot be opened.
-
getSymbolAddress
public final long getSymbolAddress(java.lang.String name)Gets the address of a symbol within theLibrary.- Parameters:
name- The name of the symbol to locate.- Returns:
- The address of the symbol within the current address space.
-
getLastError
public static final java.lang.String getLastError()Gets the current error string from dlopen/LoadLibrary.- Returns:
- A
Stringdescribing the last error.
-
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-