Package com.kenai.jffi
Class Library
java.lang.Object
com.kenai.jffi.Library
Represents a native library
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAll symbols in the library are made available to other librariesstatic final intPerform lazy binding.static final intSymbols in this library are not made available to other librariesstatic final intResolve all symbols when loading the library -
Method Summary
Modifier and TypeMethodDescriptionprotected voidfinalize()static final LibrarygetCachedInstance(String name, int flags) Gets a handle for the named library.static final LibraryGets a handle to the default library.static final StringGets the current error string from dlopen/LoadLibrary.final longgetSymbolAddress(String name) Gets the address of a symbol within theLibrary.static final LibraryopenLibrary(String name, int flags) Gets a handle for the named library.
-
Field Details
-
LAZY
public static final int LAZYPerform lazy binding. Only resolve symbols as needed- See Also:
-
NOW
public static final int NOWResolve all symbols when loading the library- See Also:
-
LOCAL
public static final int LOCALSymbols in this library are not made available to other libraries- See Also:
-
GLOBAL
public static final int GLOBALAll symbols in the library are made available to other libraries- See Also:
-
-
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
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
Gets the current error string from dlopen/LoadLibrary.- Returns:
- A
Stringdescribing the last error.
-
finalize
-