PStack
2.0
Stack trace printer for MSVC and GCC binaries
|
Encapsulate a loaded function's address into a callable functor. More...
#include <shared_library.hpp>
Public Member Functions | |
loaded_function (FARPROC proc) | |
Construct a loaded_function from a function pointer. More... | |
template<typename... Args> | |
auto | operator() (Args &&...args) -> decltype(std::declval< T >()(std::forward< Args >(args)...)) |
Invoke the library function. More... | |
Public Member Functions inherited from psystem::shared_library::loaded_function_base< T > | |
loaded_function_base (FARPROC proc) | |
Construct a loaded_function from a function pointer. More... | |
void | retarget (FARPROC proc) noexcept |
Re-assign a function pointer to this functor instance. More... | |
T * | get_ptr () const noexcept |
Access the function pointer contained here directly. More... | |
Additional Inherited Members | |
Protected Attributes inherited from psystem::shared_library::loaded_function_base< T > | |
T * | m_function |
The function pointer that may be invoked. | |
Encapsulate a loaded function's address into a callable functor.
This functor automagically determines the return type of the function passed to it, and returns the data accordingly. Also, it uses "perfect forwarding" to hand all arguments from the caller to the underlying loaded function.
std::function
, but this implementation takes much less space, and function
may even introduce a vtable, which is far too heavy.T | The function signature that will be used to store the wrapped function. |
is_void_ref | Used to determine if the loaded_function instance should provide a function with a void return type. Unless you wrap a non-void function, and explicitly want to force it into a void return type, do not specify this. The metafunction, has_void_return_type will determine the correct return automatically. |
|
inline |
Construct a loaded_function from a function pointer.
[in] | proc | The proceedure's address. Type safety is out the window; we must trust you. This may be nullptr . |
|
inline |
Invoke the library function.
Args | The argument pack should match the declared function signature. |
[in] | args | Zero or more arguments to be forwarded to the underlying function. Check the actual function signature and documentation for details. |
Whatever | the underlying function throws. |
noexcept
value when MSVC supports it.