57 template<
typename =
void>
struct Symbol;
227 typename =
typename std::enable_if_t<std::is_pointer_v<T>>>
operator T()
const noexcept {
228 return reinterpret_cast<T>(
ptr);
259 operator const T&()
const {
269 *
ptr = std::forward<T>(value);
303 R operator()(Args... args)
const noexcept {
return ptr(std::forward<Args>(args)...); }
307 using Symbol<
R(Args...)>::Symbol;
Definition DynamicLibrary.hpp:16
DynamicLibrary()
Creates a new unloaded DynamicLibrary.
static DynamicLibrary tryOpen(const NameSequence &names)
Tries to open a DynamicLibrary from a sequence of names and paths.
static const StringView prefix
A prefix added to the library name.
Definition DynamicLibrary.hpp:162
std::initializer_list< NameVariant > NameSequence
A sequence of library name variants.
Definition DynamicLibrary.hpp:174
static DynamicLibrary tryOpen(Ts &&... names)
Tries to open a DynamicLibrary from a sequence of names and paths.
Definition DynamicLibrary.hpp:208
static bool available(const FilePath &path)
Checks if a DynamicLibrary can be loaded with the given path.
DynamicLibrary(const FilePath &path, Binding binding=Binding::Immediate, Sharing sharing=Sharing::Local)
Creates a new DynamicLibrary by loading the library at the given path.
Sharing
Definition DynamicLibrary.hpp:36
@ Global
The symbols defined by this library will be made available for symbol resolution of subsequently load...
@ Local
This is the converse of global.
DynamicLibrary & operator=(const DynamicLibrary &)=delete
Copy assignment of a DynamicLibrary is not allowed.
DynamicLibrary & operator=(DynamicLibrary &&other) noexcept
Assigns the DynamicLibrary by moving the contents of another.
Binding
Definition DynamicLibrary.hpp:18
@ Immediate
All undefined symbols in the library are normalize before the constructor returns.
@ Lazy
Perform lazy binding.
~DynamicLibrary() noexcept
Unloads the dynamic library (if loaded) and destroy the DynamicLibrary object.
void unload() noexcept
Unloads the library.
bool loaded() const noexcept
Checks if the library is loaded.
NativeHandle mHandle
The native handle used to load the dynamic library.
Definition DynamicLibrary.hpp:61
static const StringView suffix
A suffix added to the library name.
Definition DynamicLibrary.hpp:166
static bool available(Ts &&... names)
Checks if a DynamicLibrary can be loaded with the given name.
Definition DynamicLibrary.hpp:198
DynamicLibrary(const DynamicLibrary &)=delete
Copy of a DynamicLibrary is not allowed.
Symbol resolve(StringView symbolName) const noexcept
Resolves a symbol by it's name.
DynamicLibrary(DynamicLibrary &&other) noexcept
Creates a new DynamicLibrary by moving the contents of another.
void * NativeHandle
A type that represents the native dynamic library handle.
Definition DynamicLibrary.hpp:53
DynamicLibrary(StringView name, Binding binding=Binding::Immediate, Sharing sharing=Sharing::Local)
Creates a new DynamicLibrary by loading the library by it's name.
Path to file or directory.
Definition FilePath.hpp:37
Definition Variant.hpp:15
Definition Application.hpp:19
bool operator!=(const ShortAllocator< T, N, A1 > &x, const ShortAllocator< U, M, A2 > &y) noexcept
Definition Allocator.hpp:416
bool operator==(const ShortAllocator< T, N, A1 > &x, const ShortAllocator< U, M, A2 > &y) noexcept
Definition Allocator.hpp:411
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
R(*)(Args...) Ptr
A function pointer type.
Definition DynamicLibrary.hpp:288
Symbol(const Ptr ptr)
Creates a new Symbol wrapper.
Definition DynamicLibrary.hpp:295
R operator()(Args... args) const noexcept
Invokes the function.
Definition DynamicLibrary.hpp:303
void * Ptr
The void* pointer type.
Definition DynamicLibrary.hpp:215
Ptr ptr
The loaded function pointer.
Definition DynamicLibrary.hpp:218
A helper structure that provides an implicit conversion operator from a loaded void* function pointer...
Definition DynamicLibrary.hpp:239
Symbol(const Ptr ptr)
Creates a new Symbol wrapper.
Definition DynamicLibrary.hpp:248
Symbol & operator=(T &&value)
Definition DynamicLibrary.hpp:268
T * Ptr
A variable pointer type.
Definition DynamicLibrary.hpp:241
T & operator*() noexcept
Definition DynamicLibrary.hpp:280
T * operator->() noexcept
Definition DynamicLibrary.hpp:274
const T * operator->() const noexcept
Definition DynamicLibrary.hpp:277
const T & operator*() const noexcept
Definition DynamicLibrary.hpp:283
Ptr ptr
A pointer to the variable.
Definition DynamicLibrary.hpp:244