cpp-sdl2
C++ header-only SDL2 wrapper
|
Represent a shared object (dynamic library, dynamically loaded library, module, plugin...). More...
#include <shared_object.hpp>
Public Types | |
using | FunctionAddress = void * |
Alias void* to a descriptive "pointer to function" typename. More... | |
Public Member Functions | |
SharedObject (std::string const &objectName) | |
Get a shared object ( = Load the named library dynamically) More... | |
SharedObject ()=default | |
Construct an empty shared object handler. You can move assign to it. More... | |
~SharedObject () | |
Automatically unload the library for you. More... | |
SharedObject (SharedObject &&other) noexcept | |
Move ctor. More... | |
SharedObject & | operator= (SharedObject &&other) noexcept |
Move shared object into this one. More... | |
SharedObject (SharedObject const &)=delete | |
This class isn't copyable. More... | |
SharedObject & | operator= (SharedObject const &)=delete |
This class isn't copyable. More... | |
FunctionAddress | function_pointer (std::string const &functionName) const |
Retrieve the raw address of a function inside the owned object. User has to cast this to the correct function pointer type. More... | |
template<typename FunctionPointerSignature > | |
FunctionPointerSignature | function_pointer (std::string const &functionName) const |
Syntactic sugar overload, provide you a way to specify the actual type of the function pointer e.g: mySharedObject.function_pointer<returnType (*) (args)>("nameOfExportedFunction");. More... | |
Private Types | |
using | SharedObjectHandle = void * |
Types should be at least named. Alias void* to "SharedObjectHandle*. More... | |
Private Attributes | |
SharedObjectHandle | handle_ = nullptr |
This class wrap an handle to a shared object. More... | |
Represent a shared object (dynamic library, dynamically loaded library, module, plugin...).
This class wraps a platform-specific "handle" to a loaded library. An instanciated SharedObject permit to retrieve callable function from them in a cross-platform way. This class automatically manages the lifetime of the loaded library for you
Definition at line 16 of file shared_object.hpp.
using sdl::SharedObject::FunctionAddress = void* |
Alias void* to a descriptive "pointer to function" typename.
Definition at line 25 of file shared_object.hpp.
|
private |
Types should be at least named. Alias void* to "SharedObjectHandle*.
Definition at line 19 of file shared_object.hpp.
|
inline |
Get a shared object ( = Load the named library dynamically)
objectName | Name of the library. |
Definition at line 29 of file shared_object.hpp.
References SharedObject().
|
default |
Construct an empty shared object handler. You can move assign to it.
Referenced by operator=(), and SharedObject().
|
inline |
Automatically unload the library for you.
Definition at line 38 of file shared_object.hpp.
|
inlinenoexcept |
Move ctor.
Definition at line 41 of file shared_object.hpp.
|
delete |
This class isn't copyable.
|
inline |
Retrieve the raw address of a function inside the owned object. User has to cast this to the correct function pointer type.
Definition at line 70 of file shared_object.hpp.
Referenced by function_pointer().
|
inline |
Syntactic sugar overload, provide you a way to specify the actual type of the function pointer e.g: mySharedObject.function_pointer<returnType (*) (args)>("nameOfExportedFunction");.
functionName | The name of a callable symbol that can be found in the loaded library |
Definition at line 81 of file shared_object.hpp.
References function_pointer().
|
inlinenoexcept |
Move shared object into this one.
Definition at line 44 of file shared_object.hpp.
References SharedObject().
|
delete |
This class isn't copyable.
|
private |
This class wrap an handle to a shared object.
Definition at line 21 of file shared_object.hpp.