jaulib v1.3.0
Jau Support Library (C++, Java, ..)
|
Runtime libary dynamic library (RTLD) access. More...
#include <native_lib.hpp>
Public Member Functions | |
void | close () noexcept |
Closes this native library. More... | |
DynamicLinker & | dynamicLinker () const noexcept |
Returns the used DynamicLinker reference. More... | |
DynamicLinker::symhandle_t | dynamicLookupFunction (const std::string &funcName) const noexcept override |
Returns the function handle for function funcName gathered within the associated native library. More... | |
DynamicLinker::symhandle_t | dynamicLookupFunctionGlobal (const std::string &funcName) const noexcept override |
Returns the function handle for function funcName gathered globally within all loaded libraries. More... | |
bool | isOpen () const noexcept |
Returns true if this instance isValid() and not close()'ed, otherwise false. More... | |
bool | isValid () const noexcept |
Returns true if this instance is valid, i.e. More... | |
DynamicLinker::libhandle_t | libraryHandle () const noexcept |
Returns the native library handle if valid and not closed, otherwise nullptr. More... | |
const std::string & | libraryPath () const noexcept |
Returns the path of the opened native library file. More... | |
const std::string & | resolvedLibraryPath () const noexcept |
Returns the resolved native path of the opened native library, might be libraryPath() if not supported by OS. More... | |
std::string | toString () const noexcept |
Public Member Functions inherited from jau::os::DynamicLookup | |
virtual | ~DynamicLookup () noexcept=default |
virtual DynamicLinker::symhandle_t | dynamicLookupFunction (const std::string &funcName) const noexcept=0 |
Returns the function handle for function funcName gathered within the associated native library. More... | |
virtual DynamicLinker::symhandle_t | dynamicLookupFunctionGlobal (const std::string &funcName) const noexcept=0 |
Returns the function handle for function funcName gathered globally within all loaded libraries. More... | |
bool | isFunctionAvailable (const std::string &funcName) const noexcept |
Queries whether function 'funcName' is available. More... | |
Static Public Member Functions | |
static NativeLibrary | open (const std::string &libName, const bool searchSystemPath, const bool searchSystemPathFirst, const bool global) noexcept |
Opens the given native library, assuming it has the same base name on all platforms. More... | |
static NativeLibrary | open (const std::string &libName, const bool searchSystemPath, const bool searchSystemPathFirst, const bool global, const std::string &symbolName) noexcept |
Opens the given native library, assuming it has the same base name on all platforms. More... | |
Runtime libary dynamic library (RTLD) access.
Definition at line 44 of file native_lib.hpp.
|
inlineoverridevirtualnoexcept |
Returns the function handle for function funcName
gathered within the associated native library.
Implements jau::os::DynamicLookup.
Definition at line 80 of file native_lib.hpp.
|
inlineoverridevirtualnoexcept |
Returns the function handle for function funcName
gathered globally within all loaded libraries.
Implements jau::os::DynamicLookup.
Definition at line 84 of file native_lib.hpp.
|
inlinenoexcept |
Returns the used DynamicLinker reference.
Definition at line 89 of file native_lib.hpp.
|
inlinenoexcept |
Returns true if this instance is valid, i.e.
native library successfully opened once but not necessarily isOpen() now.
Definition at line 95 of file native_lib.hpp.
|
inlinenoexcept |
Returns true if this instance isValid() and not close()'ed, otherwise false.
Definition at line 98 of file native_lib.hpp.
|
inlinenoexcept |
Returns the native library handle if valid and not closed, otherwise nullptr.
Definition at line 101 of file native_lib.hpp.
|
inlinenoexcept |
Returns the path of the opened native library file.
Definition at line 104 of file native_lib.hpp.
|
inlinenoexcept |
Returns the resolved native path of the opened native library, might be libraryPath() if not supported by OS.
If this native library is not isValid(), method returns an empty string.
Definition at line 112 of file native_lib.hpp.
|
inlinenoexcept |
Closes this native library.
Further lookup operations are not allowed after calling this method.
Definition at line 115 of file native_lib.hpp.
|
inlinenoexcept |
|
inlinestaticnoexcept |
Opens the given native library, assuming it has the same base name on all platforms.
The searchSystemPath
argument changes the behavior to either use the default system path or not at all.
Assuming searchSystemPath
is true
, the searchSystemPathFirst
argument changes the behavior to first search the default system path rather than searching it last.
libName | library name, with or without prefix and suffix |
searchSystemPath | if true library shall be searched in the system path (default), otherwise false . |
searchSystemPathFirst | if true system path shall be searched first (default), rather than searching it last. if searchSystemPath is false this argument is ignored. |
global | if true allows system wide access of the loaded library, otherwise access is restricted to the process. |
NativeLibrary
instance, use isValid() to check whether the native library was loaded successful. Definition at line 152 of file native_lib.hpp.
|
inlinestaticnoexcept |
Opens the given native library, assuming it has the same base name on all platforms.
The searchSystemPath
argument changes the behavior to either use the default system path or not at all.
Assuming searchSystemPath
is true
, the searchSystemPathFirst
argument changes the behavior to first search the default system path rather than searching it last.
libName | library name, with or without prefix and suffix |
searchSystemPath | if true library shall be searched in the system path (default), otherwise false . |
searchSystemPathFirst | if true system path shall be searched first (default), rather than searching it last. if searchSystemPath is false this argument is ignored. |
loader | ClassLoader to locate the library |
global | if true allows system wide access of the loaded library, otherwise access is restricted to the process. |
symbolName | optional symbol name for an OS which requires the symbol's address to retrieve the path of the containing library |
NativeLibrary
instance, use isValid() to check whether the native library was loaded successful. SecurityException | if user is not granted access for the named library. |
Definition at line 180 of file native_lib.hpp.