-
Notifications
You must be signed in to change notification settings - Fork 7
shared_library shared_library
Alairion edited this page May 8, 2021
·
11 revisions
nes::shared_library::shared_library
(1) constexpr shared_library() = default;
(2) explicit shared_library(load_current_t);
(3) explicit shared_library(const std::string& path);
(4) shared_library(const shared_library&) = delete;
(5) shared_library(shared_library&& other) noexcept;
- Constructs an empty shared library. A default constructed shared library does not represent any object. You must not call
load
on it. - Constructs a shared library that represents the calling binary. It allows you to dynamically access functions within you executable or your shared library using a literal identifier.
For executable files, you will probably need to change some linker setting in order to export functions' symbols correctly. - Constructs a shared library that represents the specified binary.
- Deleted copy-constructor.
- Move constructor. Initializes the new shared library with the content
other
. After this call,other
does no longer represents a valid binary.
Name | Description |
---|---|
path |
An UTF-8 encoded string that represents the relative or absolute path where the binary file is located |
other |
An instance of nes::shared_library
|
path
must not be an empty string.
- Explicit
- Explicit
- Does not throw
- Throw a
std::runtime_error
if the calling binary can not be loaded as a shared library - Throw a
std::runtime_error
if the file can not be found or is not a valid binary file - Deleted
- Does not throw
- On Windows, the calling binary is loaded using
GetModuleHandleW(nullptr)
On Posix systems, the calling binary is loaded usingdlopen(nullptr, RTLD_NOW)
- On Windows, the library is loaded using
LoadLibraryW(...)
On Posix systems, the library is loaded usingdlopen(..., RTLD_NOW)