Cross-platform handle to a loaded shared library (.dll / .so).
More...
#include <dynamic_library.h>
|
| bool | load (const std::filesystem::path &path) |
| | Load the library at path, unloading any loaded before it.
|
|
void | unload () |
| | Unload the library if currently loaded; idempotent.
|
| void * | symbol (const char *name) const |
| | Resolve name to a symbol address.
|
|
| static std::string | platformName (const std::string &baseName) |
| | Map a base name to its platform filename: "game" -> "game.dll" (Windows) or "libgame.so" (elsewhere).
|
Cross-platform handle to a loaded shared library (.dll / .so).
Owns the OS handle and unloads on destruction.
◆ load()
| bool Vkm::Engine::DynamicLibrary::load |
( |
const std::filesystem::path & | path | ) |
|
|
nodiscard |
Load the library at path, unloading any loaded before it.
A path, not a string: narrowing through the Windows code page cannot spell every directory name, so the loader gets the native encoding.
- Parameters
-
| path | Library file to open. |
- Returns
- Whether it opened; a failure is logged.
◆ symbol()
| void * Vkm::Engine::DynamicLibrary::symbol |
( |
const char * | name | ) |
const |
Resolve name to a symbol address.
- Parameters
-
| name | The exported symbol's name. |
- Returns
- Its address, to be cast to the expected function-pointer type; nullptr if absent or nothing is loaded.
◆ platformName()
| std::string Vkm::Engine::DynamicLibrary::platformName |
( |
const std::string & | baseName | ) |
|
|
static |
Map a base name to its platform filename: "game" -> "game.dll" (Windows) or "libgame.so" (elsewhere).
- Parameters
-
| baseName | The library's name without prefix or extension. |
- Returns
- The filename the platform's loader expects.
The documentation for this class was generated from the following file: