SharedLibrary is a RAII object wrapping a shared library.
More...
#include <SharedLibrary.hpp>
|
boost::filesystem::path | mCanonicalPath |
| Canonical path to the shared library where a canonical path is an absolute path that has no elements which are symbolic links, and no dot or dot dot elements such as "/path/../to/yourfile". More...
|
|
std::string | mPath |
| Canonical path to the shared library where a canonical path is an absolute path that has no elements which are symbolic links, and no dot or dot dot elements such as "/path/../to/yourfile". More...
|
|
DYNLIB_HANDLE | mInstance |
| Handle to the loaded library. More...
|
|
SharedLibrary is a RAII object wrapping a shared library.
◆ ProtectedConstructionTag
Enumerator |
---|
ProtectedConstruction | |
◆ SharedLibrary() [1/2]
◆ SharedLibrary() [2/2]
Constructs from a path to the shared library.
This constructor is only called by detail::SharedLibraryManager. ProtectedConstructionTag is necessary to enforce creating SharedLibrary using std::make_shared.
- Note
- Please use create() to contruct SharedLibrary instead of this constructor.
- Parameters
-
[in] | path | The canonical path to the shared library. |
- Returns
- Pointer to the created SharedLibrary upon success in loading. Otherwise, returns nullptr.
◆ ~SharedLibrary()
dart::common::SharedLibrary::~SharedLibrary |
( |
| ) |
|
|
virtual |
◆ create() [1/2]
std::shared_ptr< SharedLibrary > dart::common::SharedLibrary::create |
( |
const boost::filesystem::path & |
path | ) |
|
|
static |
Creates a SharedLibrary from a path to the shared library.
- Note
- SharedLibrary should be always created from this create function.
- Parameters
-
[in] | path | The path to the shared library. The path can be a relative path or an absolute path. If the path doens't exist this function returns nullptr. If the path exist, the path will be stored as the canonical path where a canonical path is an absolute path that has no elements which are symbolic links, and no dot or dot dot elements such as "/path/../to/yourfile". |
- Returns
- Pointer to the created SharedLibrary upon success in loading. Otherwise, returns nullptr.
- Deprecated:
- Deprecated in 6.10. Please use create(const std::string&) instead.
◆ create() [2/2]
std::shared_ptr< SharedLibrary > dart::common::SharedLibrary::create |
( |
const std::string & |
path | ) |
|
|
static |
Creates a SharedLibrary from a path to the shared library.
- Note
- SharedLibrary should be always created from this create function.
- Parameters
-
[in] | path | The path to the shared library. The path can be a relative path or an absolute path. If the path doens't exist this function returns nullptr. If the path exist, the path will be stored as the canonical path where a canonical path is an absolute path that has no elements which are symbolic links, and no dot or dot dot elements such as "/path/../to/yourfile". |
- Returns
- Pointer to the created SharedLibrary upon success in loading. Otherwise, returns nullptr.
◆ getCanonicalPath()
const boost::filesystem::path & dart::common::SharedLibrary::getCanonicalPath |
( |
| ) |
const |
Returns the path to the shared library file.
◆ getLastError()
std::string dart::common::SharedLibrary::getLastError |
( |
| ) |
const |
|
private |
Returns the last loading error.
◆ getSymbol()
void * dart::common::SharedLibrary::getSymbol |
( |
const std::string & |
symbolName | ) |
const |
Returns a symbol from the shared library if it exists.
Return nullptr otherwise.
You have to reinterpret_cast the return value to the appropriate type to make use of the void* returned by this function.
◆ isValid()
bool dart::common::SharedLibrary::isValid |
( |
| ) |
const |
Returns true if the shared library loading was successful.
◆ path()
const std::string & dart::common::SharedLibrary::path |
( |
| ) |
const |
Returns the path to the shared library file.
◆ detail::SharedLibraryManager
◆ mCanonicalPath
boost::filesystem::path dart::common::SharedLibrary::mCanonicalPath |
|
protected |
Canonical path to the shared library where a canonical path is an absolute path that has no elements which are symbolic links, and no dot or dot dot elements such as "/path/../to/yourfile".
◆ mInstance
DYNLIB_HANDLE dart::common::SharedLibrary::mInstance |
|
protected |
Handle to the loaded library.
◆ mPath
std::string dart::common::SharedLibrary::mPath |
|
protected |
Canonical path to the shared library where a canonical path is an absolute path that has no elements which are symbolic links, and no dot or dot dot elements such as "/path/../to/yourfile".