Class to create callback objects, that can be passed to functions as callback function pointers. In other words, a pointer to the callback object can be "called", directly. A generic callback handler invoked by this object then allows iterating dynamically over the arguments once called back.
More...
#include <callback.hpp>
|
using | CallbackHandler = void(*)(const Method *method, MemAddr data, uint64_t *params, size_t count, void *ret) |
| CallbackHandler is a function pointer type for generic callback invocation. The params argument can be accessed safely and conveniently using ParametersSpan, and the ret argument (return value storage) can be managed using ReturnSlot. These helper classes provide type-safe and ergonomic access to arguments and return values.
|
|
using | HiddenParam = bool(*)(ValueType) |
| HiddenParam is a predicate function pointer to determine if a ValueType should be passed as a hidden parameter. Use for return structs on x86 and arm arch.
|
|
|
PLUGIFY_ACCESS | : struct Impl |
|
Class to create callback objects, that can be passed to functions as callback function pointers. In other words, a pointer to the callback object can be "called", directly. A generic callback handler invoked by this object then allows iterating dynamically over the arguments once called back.
Definition at line 24 of file callback.hpp.
◆ CallbackHandler
CallbackHandler is a function pointer type for generic callback invocation. The params
argument can be accessed safely and conveniently using ParametersSpan, and the ret
argument (return value storage) can be managed using ReturnSlot. These helper classes provide type-safe and ergonomic access to arguments and return values.
Definition at line 55 of file callback.hpp.
◆ HiddenParam
HiddenParam is a predicate function pointer to determine if a ValueType should be passed as a hidden parameter. Use for return structs on x86 and arm arch.
Definition at line 67 of file callback.hpp.
◆ JitCallback() [1/2]
plugify::JitCallback::JitCallback |
( |
const JitCallback & |
other | ) |
|
|
delete |
Copy constructor.
- Parameters
-
◆ JitCallback() [2/2]
plugify::JitCallback::JitCallback |
( |
JitCallback && |
other | ) |
|
|
noexcept |
Move constructor.
- Parameters
-
◆ GetError()
std::string_view plugify::JitCallback::GetError |
( |
| ) |
|
|
noexcept |
Get the error message, if any.
- Returns
- Error message.
◆ GetFunction()
MemAddr plugify::JitCallback::GetFunction |
( |
| ) |
const |
|
noexcept |
Get a dynamically created function.
- Returns
- Pointer to the already generated function.
- Note
- The returned pointer can be nullptr if function is not generate.
◆ GetJitFunc() [1/2]
Generates a callback function matching the specified method signature.
- Parameters
-
method | The method descriptor defining the function signature. |
callback | Pointer to the generic callback handler to invoke. |
data | Optional user data passed to the callback handler. |
hidden | Predicate to determine if the return value should be passed as a hidden argument. |
- Returns
- Pointer to the generated function, or nullptr if generation fails.
This function creates a JIT-compiled callback based on the provided method, allowing dynamic invocation with runtime argument handling. The callback handler receives arguments and user data as specified. If the hidden predicate returns true, the return value is passed as an additional hidden parameter.
◆ GetJitFunc() [2/2]
Generates a JIT-compiled callback function based on the provided raw signature.
- Parameters
-
signature | The function signature to use for the generated callback. |
method | Optional pointer to a method descriptor for additional context. May be nullptr if not needed. |
callback | Pointer to the callback handler to invoke. |
data | User data to be passed to the callback handler. |
hidden | If true, the return value will be passed as a hidden argument. |
- Returns
- Pointer to the generated function, or nullptr if generation fails.
The method
pointer can be nullptr and is provided for context in addition to user data, as it is common to access both in callback scenarios.
◆ GetUserData()
MemAddr plugify::JitCallback::GetUserData |
( |
| ) |
const |
|
noexcept |
Get the user data associated with the object.
This function returns a pointer to the user data associated with the object.
- Returns
- A void pointer to the user data.
- Note
- The returned pointer can be nullptr if no user data is set.
◆ operator=() [1/2]
Copy assignment operator for JitCallback.
- Parameters
-
- Returns
- A reference to this instance after copying.
◆ operator=() [2/2]
Move assignment operator for JitCall.
- Parameters
-
- Returns
- A reference to this instance after moving.
- Note
- This operator is marked noexcept to indicate it does not throw exceptions.
◆ __pad0__
PLUGIFY_ACCESS plugify::JitCallback::__pad0__ |
The documentation for this class was generated from the following file: