A shared library opened at run time (.so, .dylib or .dll), closed when destroyed.
More...
#include <aegis2d/core/shared_library.hpp>
A shared library opened at run time (.so, .dylib or .dll), closed when destroyed.
Opens any library and finds its functions by name. Its functions and data are unusable once it is closed, so keep it alive as long as anything from it is used.
◆ SharedLibrary() [1/3]
| aegis2d::core::SharedLibrary::SharedLibrary |
( |
const std::filesystem::path & |
path | ) |
|
|
explicit |
Opens a library, with every symbol resolved now.
On Windows, the DLLs it needs are also looked for in its own folder.
- Parameters
-
| path | Path of the library file. |
- Exceptions
-
| LibraryError | if the system cannot open it, with the system's reason. |
◆ ~SharedLibrary()
| aegis2d::core::SharedLibrary::~SharedLibrary |
( |
| ) |
|
◆ SharedLibrary() [2/3]
| aegis2d::core::SharedLibrary::SharedLibrary |
( |
const SharedLibrary & |
| ) |
|
|
delete |
◆ SharedLibrary() [3/3]
| aegis2d::core::SharedLibrary::SharedLibrary |
( |
SharedLibrary && |
other | ) |
|
|
noexcept |
Takes the library over; other no longer holds one.
- Parameters
-
| other | Library to take over. |
◆ function()
template<typename Function >
| Function * aegis2d::core::SharedLibrary::function |
( |
const std::string & |
name | ) |
const |
|
inlinenoexcept |
An exported function, with its type.
- Template Parameters
-
| Function | Type of the function, e.g. int(int). |
- Parameters
-
| name | Name of the function, as exported. |
- Returns
- A pointer to it, or null when the library does not export it.
◆ operator=() [1/2]
◆ operator=() [2/2]
Closes the library held, then takes other's over.
- Parameters
-
| other | Library to take over. |
- Returns
- This library.
◆ path()
| const std::filesystem::path & aegis2d::core::SharedLibrary::path |
( |
| ) |
const |
|
inlinenoexcept |
Path the library was opened from.
- Returns
- The path given to the constructor.
◆ symbol()
| void * aegis2d::core::SharedLibrary::symbol |
( |
const std::string & |
name | ) |
const |
|
noexcept |
Address of an exported symbol.
- Parameters
-
| name | Name of the symbol, as exported (C names are not mangled). |
- Returns
- Its address, or null when the library does not export it.
The documentation for this class was generated from the following file: