|
infix
A JIT-Powered FFI Library for C
|
Cookbook Chapter 7: Introspecting a Trampoline for a Wrapper. More...
Functions | |
| static int | add_and_multiply (int a, double b) |
| static bool | dynamic_wrapper (infix_forward_t *trampoline, void *target_func, void **args, size_t num_provided_args, void *ret_buffer) |
| A conceptual generic "wrapper" function for an unbound trampoline. | |
| int | main () |
Cookbook Chapter 7: Introspecting a Trampoline for a Wrapper.
This example demonstrates how a language binding or a generic wrapper function can use the trampoline introspection API to validate arguments at runtime before making an FFI call. This allows for more robust error checking.
|
static |
|
static |
A conceptual generic "wrapper" function for an unbound trampoline.
In a real language binding, this function would take language-native objects as arguments, unbox them into a C void** array, and perform type checking.
| trampoline | An unbound trampoline for the desired signature. |
| target_func | The native C function to call. |
| args | An array of pointers to the C argument values. |
| num_provided_args | The number of arguments provided by the caller. |
| ret_buffer | A buffer to receive the return value. |
true on success, false on failure. | int main | ( | void | ) |