1#ifndef SDL3PP_LOADSO_H_
2#define SDL3PP_LOADSO_H_
4#include <SDL3/SDL_loadso.h>
5#include "SDL3pp_stdinc.h"
70 constexpr explicit operator bool()
const {
return !!
value; }
109 : m_resource(resource)
143 : m_resource(SDL_LoadObject(sofile))
153 std::swap(m_resource, other.m_resource);
170 m_resource =
nullptr;
179 constexpr explicit operator bool() const noexcept {
return !!m_resource; }
311 return SDL_LoadFunction(handle, name);
An opaque datatype that represents a loaded shared object.
Definition: SDL3pp_loadso.h:91
constexpr SharedObject(const SharedObjectRaw resource) noexcept
Constructs from SharedObjectParam.
Definition: SDL3pp_loadso.h:108
constexpr SharedObject & operator=(const SharedObject &other) noexcept=default
Assignment operator.
constexpr SharedObjectRaw get() const noexcept
Retrieves underlying SharedObjectRaw.
Definition: SDL3pp_loadso.h:164
SharedObject(StringParam sofile)
Dynamically load a shared object.
Definition: SDL3pp_loadso.h:142
constexpr SharedObject(const SharedObject &other) noexcept=default
Copy constructor.
constexpr auto operator<=>(const SharedObject &other) const noexcept=default
Comparison.
constexpr SharedObject(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_loadso.h:96
constexpr SharedObjectRaw release() noexcept
Retrieves underlying SharedObjectRaw and clear this.
Definition: SDL3pp_loadso.h:167
~SharedObject()
Destructor.
Definition: SDL3pp_loadso.h:148
constexpr SharedObject & operator=(SharedObject &&other) noexcept
Assignment operator.
Definition: SDL3pp_loadso.h:151
constexpr SharedObject(SharedObject &&other) noexcept
Move constructor.
Definition: SDL3pp_loadso.h:119
Helpers to use C++ strings parameters.
Definition: SDL3pp_strings.h:43
FunctionPointer LoadFunction(StringParam name)
Look up the address of the named function in a shared object.
Definition: SDL3pp_loadso.h:314
SharedObject LoadObject(StringParam sofile)
Dynamically load a shared object.
Definition: SDL3pp_loadso.h:277
void UnloadObject(SharedObjectRaw handle)
Unload a shared object from memory.
Definition: SDL3pp_loadso.h:334
void Unload()
Unload a shared object from memory.
Definition: SDL3pp_loadso.h:336
FunctionPointer LoadFunction(SharedObjectParam handle, StringParam name)
Look up the address of the named function in a shared object.
Definition: SDL3pp_loadso.h:309
SDL_SharedObject * SharedObjectRaw
Alias to raw representation for SharedObject.
Definition: SDL3pp_loadso.h:47
void(SDLCALL *)() FunctionPointer
A generic function pointer.
Definition: SDL3pp_stdinc.h:6388
Main include header for the SDL3pp library.
Safely wrap SharedObject for non owning parameters.
Definition: SDL3pp_loadso.h:54
SharedObjectRaw value
parameter's SharedObjectRaw
Definition: SDL3pp_loadso.h:55
constexpr SharedObjectParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_loadso.h:64
constexpr SharedObjectParam(SharedObjectRaw value)
Constructs from SharedObjectRaw.
Definition: SDL3pp_loadso.h:58
constexpr auto operator<=>(const SharedObjectParam &other) const =default
Comparison.
Semi-safe reference for SharedObject.
Definition: SDL3pp_loadso.h:229
SharedObjectRef(SharedObjectParam resource) noexcept
Constructs from SharedObjectParam.
Definition: SDL3pp_loadso.h:239
SharedObjectRef(SharedObjectRaw resource) noexcept
Constructs from SharedObjectParam.
Definition: SDL3pp_loadso.h:251
~SharedObjectRef()
Destructor.
Definition: SDL3pp_loadso.h:260
constexpr SharedObjectRef(const SharedObjectRef &other) noexcept=default
Copy constructor.