1#ifndef SDL3PP_LOADSO_H_
2#define SDL3PP_LOADSO_H_
4#include <SDL3/SDL_loadso.h>
5#include "SDL3pp_stdinc.h"
45struct SharedObjectBase;
48struct SharedObjectRef;
117 return SDL_LoadFunction(
get(), name);
175 void reset(SDL_SharedObject* newResource = {})
177 SDL_UnloadObject(
release(newResource));
215 constexpr SharedObject(
const SharedObject& other) =
delete;
A SDL managed resource.
Definition SDL3pp_resource.h:17
constexpr SDL_SharedObject * release(SDL_SharedObject * newResource={})
Return contained resource and empties or replace value.
Definition SDL3pp_resource.h:60
constexpr Resource(T resource={})
Constructs the underlying resource.
Definition SDL3pp_resource.h:22
constexpr SDL_SharedObject * get() const
Return contained resource;.
Definition SDL3pp_resource.h:57
Helpers to use C++ strings parameters.
Definition SDL3pp_strings.h:43
SDL_FunctionPointer FunctionPointer
A generic function pointer.
Definition SDL3pp_stdinc.h:5484
the main namespace where all SDL3pp public functions and types live
Definition SDL3pp_assert.h:7
An opaque datatype that represents a loaded shared object.
Definition SDL3pp_loadso.h:67
FunctionPointer LoadFunction(StringParam name)
Look up the address of the named function in a shared object.
Definition SDL3pp_loadso.h:115
SharedObjectBase(StringParam sofile)
Dynamically load a shared object.
Definition SDL3pp_loadso.h:84
Handle to a non owned sharedObject.
Definition SDL3pp_loadso.h:130
constexpr SharedObjectRef(const SharedObjectRef &other)
Copy constructor.
Definition SDL3pp_loadso.h:136
constexpr SharedObjectRef(SharedObjectRef &&other)
Move constructor.
Definition SDL3pp_loadso.h:144
void Unload()
Unload a shared object from memory.
Definition SDL3pp_loadso.h:192
void reset(SDL_SharedObject *newResource={})
Unload a shared object from memory.
Definition SDL3pp_loadso.h:175
SharedObjectRef & operator=(SharedObjectRef other)
Assignment operator.
Definition SDL3pp_loadso.h:157
constexpr ~SharedObjectRef()=default
Default constructor.
Handle to an owned sharedObject.
Definition SDL3pp_loadso.h:204
constexpr SharedObject(SharedObject &&other)=default
Move constructor.
SharedObject & operator=(SharedObject other)
Assignment operator.
Definition SDL3pp_loadso.h:230
~SharedObject()
Frees up resource when object goes out of scope.
Definition SDL3pp_loadso.h:225
constexpr SharedObject(SDL_SharedObject *resource={})
Constructs from the underlying resource.
Definition SDL3pp_loadso.h:210