|
GREM 3.12.0
Game/Rendering Engine Modules for C++
|
Library of dynamically loaded symbols. More...
#include <GREM/core/system/SharedLibrary.hpp>
Classes | |
| struct | Error |
| Exception type for errors that may arise from a SharedLibrary. More... | |
Public Member Functions | |
| SharedLibrary () noexcept=default | |
| Construct a closed shared library. | |
| SharedLibrary (const Filesystem &filesystem, CStringView filepath) | |
| Construct a shared library opened from a file. | |
| operator bool () const noexcept | |
| Check if the shared library is currently open. | |
| bool | is_open () const noexcept |
| Check if the shared library is currently open. | |
| void | close () |
| Close the shared library if it is currently open, invalidating all current pointers to its symbols from this program. | |
| void | open (const Filesystem &filesystem, CStringView filepath) |
| Open the shared library from a file. | |
| template<typename T> | |
| T & | getSymbol (CStringView name) |
| Get a reference to the symbol with a specific name in the library. | |
Static Public Member Functions | |
| static CStringView | getLibraryFilenameExtension () |
| Get the proper filename extension for shared libraries on the current platform. | |
Library of dynamically loaded symbols.
On Windows, this corresponds to a Dynamically Linked Library (.dll file). On Linux, this corresponds to a Dynamic Shared Object (.so file). On Apple platforms, this corresponds to a Dynamic Library (.dylib file). On other platforms, shared libraries are unsupported, and attempting to open one always fails.
|
defaultnoexcept |
Construct a closed shared library.
|
inlineexplicit |
Construct a shared library opened from a file.
| filesystem | filesystem to load the file from. |
| filepath | input filepath of the shared library file to open. |
| File::Error | on failure to locate the file. |
| SharedLibrary::Error | on failure to open the library. |
| std::bad_alloc | on allocation failure. |
|
staticnodiscard |
Get the proper filename extension for shared libraries on the current platform.
|
inlineexplicitnoexcept |
Check if the shared library is currently open.
|
inlinenodiscardnoexcept |
Check if the shared library is currently open.
| void grem::SharedLibrary::close | ( | ) |
Close the shared library if it is currently open, invalidating all current pointers to its symbols from this program.
| SharedLibrary::Error | on failure to close the library. |
| std::bad_alloc | on allocation failure. |
| void grem::SharedLibrary::open | ( | const Filesystem & | filesystem, |
| CStringView | filepath ) |
Open the shared library from a file.
| filesystem | filesystem to load the file from. |
| filepath | input filepath of the shared library file to open. |
| File::Error | on failure to locate the file. |
| SharedLibrary::Error | on failure to open the library. |
| std::bad_alloc | on allocation failure. |
|
inline |
Get a reference to the symbol with a specific name in the library.
| T | type of the symbol to get. Must exactly match the type of the specified symbol in the library. |
| name | exact, potentially mangled, name of the symbol to search for. |
| SharedLibrary::Error | on failure to find or retrieve the symbol address. |
| std::bad_alloc | on allocation failure. |