SharedLibrary
SharedLibrary
#include <icy/sharedlibrary.h>struct SharedLibraryDefined in src/base/include/icy/sharedlibrary.h:24
Loads a shared library at runtime and resolves exported symbols.
List of all members
| Name | Kind | Owner |
|---|---|---|
open | function | Declared here |
close | function | Declared here |
sym | function | Declared here |
setError | function | Declared here |
error | function | Declared here |
_lib | variable | Declared here |
_error | variable | Declared here |
Public Methods
| Return | Name | Description |
|---|---|---|
bool | open inline | Opens a shared library. The filename is in utf-8. Returns true on success and false on error. Call [SharedLibrary::error()](#error-7) to get the error message. |
void | close inline | Closes the shared library. |
bool | sym inline | Retrieves a data pointer from a dynamic library. It is legal for a symbol to map to nullptr. Returns 0 on success and -1 if the symbol was not found. |
void | setError inline | Reads the last libuv dynamic-linker error, stores it in _error, and throws a std::runtime_error with the combined prefix and error message. |
std::string | error const inline | Returns the last error message recorded by setError(). Empty if no error has occurred. |
open
inline
inline bool open(const std::string & path)Defined in src/base/include/icy/sharedlibrary.h:29
Opens a shared library. The filename is in utf-8. Returns true on success and false on error. Call [SharedLibrary::error()](#error-7) to get the error message.
close
inline
inline void close()Defined in src/base/include/icy/sharedlibrary.h:39
Closes the shared library.
sym
inline
inline bool sym(const char * name, void ** ptr)Defined in src/base/include/icy/sharedlibrary.h:47
Retrieves a data pointer from a dynamic library. It is legal for a symbol to map to nullptr. Returns 0 on success and -1 if the symbol was not found.
setError
inline
inline void setError(const std::string & prefix)Defined in src/base/include/icy/sharedlibrary.h:60
Reads the last libuv dynamic-linker error, stores it in _error, and throws a std::runtime_error with the combined prefix and error message.
Parameters
prefixHuman-readable context string prepended to the error detail.
Exceptions
std::runtime_erroralways.
error
const inline
inline std::string error() constDefined in src/base/include/icy/sharedlibrary.h:72
Returns the last error message recorded by setError(). Empty if no error has occurred.
Returns
Last error string.
Protected Attributes
_lib
uv_lib_t _libDefined in src/base/include/icy/sharedlibrary.h:75
_error
std::string _error