Low level secure dynamic linker access.
More...
#include <dyn_linker.hpp>
|
| static std::vector< std::string > | enumerateLibraryPaths (const std::string &libName, bool searchSystemPath=false, bool searchSystemPathFirst=false) noexcept |
| | Returns list of potential absolute library filenames.
|
| |
| static DynamicLinker & | get () noexcept |
| | Returns static singleton instance of DynamicLinker.
|
| |
| static std::string | getBaseName (const std::string &filename, const bool isBasename=false, const bool caseInsensitive=jau::os::is_windows()) noexcept |
| | Returns the library basename, i.e.
|
| |
| static constexpr_cxx20 std::string | getCanonicalName (const std::string &basename, const bool checkIsCanonical=true) noexcept |
| | Returns canonical library name for this system from given library-basename, e.g.
|
| |
| static constexpr_cxx20 std::string | getDefaultPrefix () noexcept |
| | Returns the native library prefix, e.g.
|
| |
| static constexpr_cxx20 std::string | getDefaultSuffix () noexcept |
| | Returns the native library suffix including the dot, e.g.
|
| |
| static constexpr_cxx20 std::string | getEnvLibPathVarName () noexcept |
| | Returns the environment library path variable name, e.g.
|
| |
| static std::vector< std::string > | getSystemEnvLibraryPaths () |
| | Returns a list of system paths, from the getSystemEnvLibraryPathVarname() variable.
|
| |
| static bool | isCanonicalName (const std::string &filename, const bool isBasename=false, const bool caseInsensitive=jau::os::is_windows()) noexcept |
| | Returns true if the given filename contains the canonical prefix and suffix, otherwise returns false.
|
| |
Low level secure dynamic linker access.
Definition at line 45 of file dyn_linker.hpp.
◆ libhandle_t
◆ symhandle_t
◆ DynamicLinker()
| jau::os::DynamicLinker::DynamicLinker |
( |
| ) |
|
|
protecteddefaultnoexcept |
◆ ~DynamicLinker()
| virtual jau::os::DynamicLinker::~DynamicLinker |
( |
| ) |
|
|
virtualdefaultnoexcept |
◆ openLibraryGlobalImpl()
| virtual libhandle_t jau::os::DynamicLinker::openLibraryGlobalImpl |
( |
const std::string & | pathname | ) |
|
|
protectedpure virtualnoexcept |
◆ openLibraryLocalImpl()
| virtual libhandle_t jau::os::DynamicLinker::openLibraryLocalImpl |
( |
const std::string & | pathname | ) |
|
|
protectedpure virtualnoexcept |
◆ lookupLibraryPathnameImpl()
| virtual const char * jau::os::DynamicLinker::lookupLibraryPathnameImpl |
( |
libhandle_t | libraryHandle, |
|
|
const std::string & | symbolName ) |
|
protectedpure virtualnoexcept |
◆ lookupSymbolGlobalImpl()
| virtual symhandle_t jau::os::DynamicLinker::lookupSymbolGlobalImpl |
( |
const std::string & | symbolName | ) |
|
|
protectedpure virtualnoexcept |
◆ lookupSymbolLocalImpl()
| virtual symhandle_t jau::os::DynamicLinker::lookupSymbolLocalImpl |
( |
libhandle_t | handle, |
|
|
const std::string & | symbolName ) |
|
protectedpure virtualnoexcept |
◆ closeLibraryImpl()
| virtual void jau::os::DynamicLinker::closeLibraryImpl |
( |
libhandle_t | handle | ) |
|
|
protectedpure virtualnoexcept |
◆ getLastErrorImpl()
| virtual std::string jau::os::DynamicLinker::getLastErrorImpl |
( |
| ) |
|
|
protectedpure virtualnoexcept |
◆ incrLibRefCount()
| LibRef_ref jau::os::DynamicLinker::incrLibRefCount |
( |
const libhandle_t | handle, |
|
|
const std::string & | libName ) |
|
inlineprotectednoexcept |
◆ decrLibRefCount()
| LibRef_ref jau::os::DynamicLinker::decrLibRefCount |
( |
const libhandle_t | handle | ) |
|
|
inlineprotectednoexcept |
◆ getEnvLibPathVarName()
| static constexpr_cxx20 std::string jau::os::DynamicLinker::getEnvLibPathVarName |
( |
| ) |
|
|
inlinestaticnoexcept |
Returns the environment library path variable name, e.g.
LD_LIBRARY_PATH
Definition at line 143 of file dyn_linker.hpp.
◆ getSystemEnvLibraryPaths()
| static std::vector< std::string > jau::os::DynamicLinker::getSystemEnvLibraryPaths |
( |
| ) |
|
|
inlinestatic |
◆ getDefaultPrefix()
| static constexpr_cxx20 std::string jau::os::DynamicLinker::getDefaultPrefix |
( |
| ) |
|
|
inlinestaticnoexcept |
Returns the native library prefix, e.g.
lib
Definition at line 160 of file dyn_linker.hpp.
◆ getDefaultSuffix()
| static constexpr_cxx20 std::string jau::os::DynamicLinker::getDefaultSuffix |
( |
| ) |
|
|
inlinestaticnoexcept |
Returns the native library suffix including the dot, e.g.
.so
Definition at line 168 of file dyn_linker.hpp.
◆ getCanonicalName()
| static constexpr_cxx20 std::string jau::os::DynamicLinker::getCanonicalName |
( |
const std::string & | basename, |
|
|
const bool | checkIsCanonical = true ) |
|
inlinestaticnoexcept |
◆ isCanonicalName()
| bool jau::os::DynamicLinker::isCanonicalName |
( |
const std::string & | filename, |
|
|
const bool | isBasename = false, |
|
|
const bool | caseInsensitive = jau::os::is_windows() ) |
|
staticnoexcept |
Returns true if the given filename contains the canonical prefix and suffix, otherwise returns false.
Validation is performed case insensitive if caseInsensitive == true
- Parameters
-
| filename | the filename to test |
| isBasename | pass true if filename is a basename, otherwise false. Defaults to false. See jau::fs::basename(). |
| caseInsensitive | perform prefix and suffix comparison case-insensitive, defaults to true on Windows otherwise false |
- See also
- getCanonicalName()
-
getBaseName()
-
jau::fs::basename()
Definition at line 225 of file os_support.cpp.
◆ getBaseName()
| std::string jau::os::DynamicLinker::getBaseName |
( |
const std::string & | filename, |
|
|
const bool | isBasename = false, |
|
|
const bool | caseInsensitive = jau::os::is_windows() ) |
|
staticnoexcept |
Returns the library basename, i.e.
the file basename without prefix nor suffix, performed case insensitive if caseInsensitive == true
- Parameters
-
| filename | the filename to process |
| isBasename | pass true if filename is a basename, otherwise false. Defaults to false. See jau::fs::basename(). |
| caseInsensitive | perform prefix and suffix comparison case-insensitive, defaults to true on Windows otherwise false |
- Returns
- basename of filename w/o path nor prefix or suffix, ie. /usr/lib/libDrinkBeer.so -> DrinkBeer on Unix systems
- See also
- getCanonicalName()
-
isCanonicalName()
-
jau::fs::basename()
Definition at line 221 of file os_support.cpp.
◆ enumerateLibraryPaths()
| std::vector< std::string > jau::os::DynamicLinker::enumerateLibraryPaths |
( |
const std::string & | libName, |
|
|
bool | searchSystemPath = false, |
|
|
bool | searchSystemPathFirst = false ) |
|
staticnoexcept |
Returns list of potential absolute library filenames.
- Parameters
-
| libName | library basename (implies file-basename) or canonical-library-name as file-basename or absolute-path |
| searchSystemPath | |
| searchSystemPathFirst | |
Definition at line 280 of file os_support.cpp.
◆ get()
◆ openLibraryGlobal()
| libhandle_t jau::os::DynamicLinker::openLibraryGlobal |
( |
const std::string & | pathname | ) |
|
|
inlinenoexcept |
Opens the named library, allowing system wide access for other users.
- Parameters
-
| pathname | the full pathname for the library to open |
- Returns
- the library handle, maybe 0 if not found.
Definition at line 256 of file dyn_linker.hpp.
◆ openLibraryLocal()
| libhandle_t jau::os::DynamicLinker::openLibraryLocal |
( |
const std::string & | pathname | ) |
|
|
inlinenoexcept |
Opens the named library, restricting access to this process.
- Parameters
-
| pathname | the full pathname for the library to open |
- Returns
- the library handle, maybe 0 if not found.
Definition at line 275 of file dyn_linker.hpp.
◆ lookupLibraryPathname()
| const char * jau::os::DynamicLinker::lookupLibraryPathname |
( |
libhandle_t | handle, |
|
|
const std::string & | symbolName ) |
|
inlinenoexcept |
- Parameters
-
- Returns
- the library pathname if found and supported by OS or
null.
Definition at line 293 of file dyn_linker.hpp.
◆ lookupSymbolGlobal()
| symhandle_t jau::os::DynamicLinker::lookupSymbolGlobal |
( |
const std::string & | symbolName | ) |
|
|
inlinenoexcept |
- Parameters
-
| symbolName | global symbol name to lookup up system wide. |
- Returns
- the symbol handle, maybe nullptr if not found.
Definition at line 306 of file dyn_linker.hpp.
◆ lookupSymbol()
- Parameters
-
- Returns
- the symbol handle, maybe nullptr if not found.
Definition at line 320 of file dyn_linker.hpp.
◆ closeLibrary()
| void jau::os::DynamicLinker::closeLibrary |
( |
libhandle_t | handle | ) |
|
|
inlinenoexcept |
◆ getLastError()
| std::string jau::os::DynamicLinker::getLastError |
( |
| ) |
|
|
inlinenoexcept |
Returns a string containing the last error.
Maybe called for debugging purposed if any method fails.
- Returns
- error string, maybe null. A null or non-null value has no semantics.
Definition at line 353 of file dyn_linker.hpp.
◆ DEBUG_LOOKUP
| const bool jau::os::DynamicLinker::DEBUG_LOOKUP = false |
|
staticconstexprprotected |
The documentation for this class was generated from the following files: