Overview
Thecaller API provides a lightweight, zero-overhead abstraction for invoking functions located at arbitrary memory addresses. It offers strongly-typed function pointer wrappers that enable safe invocation of dynamically resolved symbols, JIT-compiled code, or runtime-patched functions.
Types
caller_t<Sig>
A strongly-typed wrapper around a raw function pointer.
Raw function pointer to the target function. No ownership semantics or lifetime guarantees.
Invokes the stored function pointer with the provided arguments. Returns the result of the function call.Preconditions:
fn != nullptr- The address is valid and correctly aligned
- The signature matches the actual function
Returns
true if the function pointer is non-null, false otherwise.Functions
caller<Sig>()
Factory function that creates a caller_t<Sig> from any address-like value.
Function signature (e.g.,
int(int, int) or void(const char*))Address of the function. Accepts:
- Raw pointers (
int (*)(int)) std::uintptr_t/std::intptr_tstx::va_t(virtual address)
rva_t or offset_t.A callable wrapper around the function pointer at the specified address.
Usage Examples
Calling a Known Function
Using with Virtual Address
Using with Raw Integer Address
Null Safety Check
Calling an External Symbol
Example scenario: resolved symbol from dynamic loader.Design Characteristics
| Property | Description |
|---|---|
| Zero abstraction overhead | Direct wrapper around raw function pointer |
| Strong signature binding | Signature enforced at compile time |
| Explicit validity check | operator bool() verifies non-null |
constexpr friendly | Fully usable in constant evaluation contexts |
noexcept call operator | Assumes target function does not violate contract |
Safety Considerations
Intended Use Cases
- Manual symbol resolution
- Runtime patching and hooking systems
- Loader implementations
- Low-level tooling and debugging utilities
- JIT integration layers
- Dynamic library function invocation
Related APIs
address_likeconcept fromcore.hppnormalize_addr()for address normalizationva_tfor virtual address representation