-
Notifications
You must be signed in to change notification settings - Fork 7
shared_library load
Alairion edited this page May 8, 2021
·
8 revisions
nes::shared_library::load
template<typename Func, typename = std::enable_if_t<std::is_pointer_v<Func> && std::is_function_v<std::remove_pointer_t<Func>>>>
(1) Func load(const std::string& symbol) const noexcept;
template<typename Func, typename = std::enable_if_t<std::is_function_v<Func>>>
(2) Func* load(const std::string& symbol) const noexcept;- Load a function within the binary. This function returns a pointer to the specified function, or
nullptrif the function can not be found. - Calls
load<Func*>(symbol).
| Name | Description |
|---|---|
symbol |
The symbol name, i.e. the function name |
- Return a function pointer, of type
Func, on the requested function, on if it can be found. Otherwise, returnnullptr. - Return a function pointer, of type
Func*, on the requested function, on if it can be found. Otherwise, returnnullptr.
*this must represents a valid binary.
symbol must not be an empty string.
- Resolves only if
Funcis a function pointer. - Resolves only if
Funcis a function.
Constant.
Does not throw.
- On Windows, the symbol is loaded using
GetProcAddress
On Posix systems, the symbol is loaded usingdlsym - This function is just a wrapper around the first one