|
infix
A JIT-Powered FFI Library for C
|
A lower-level, programmatic API for creating trampolines from infix_type objects. More...
Topics | |
| Type System | |
| The core data structures and APIs for describing C types and function signatures. | |
A lower-level, programmatic API for creating trampolines from infix_type objects.
This API is intended for performance-critical applications or language bindings that need to construct type information dynamically without the overhead of string parsing. All infix_type objects passed to these functions must be allocated from an infix_arena_t.
| INFIX_API INFIX_NODISCARD infix_status infix_forward_create_manual | ( | infix_forward_t ** | out_trampoline, |
| infix_type * | return_type, | ||
| infix_type ** | arg_types, | ||
| size_t | num_args, | ||
| size_t | num_fixed_args, | ||
| void * | target_function ) |
Creates a bound forward trampoline from infix_type objects.
| [out] | out_trampoline | Receives the created trampoline handle. |
| [in] | return_type | The infix_type for the function's return value. |
| [in] | arg_types | An array of infix_type* for the function's arguments. |
| [in] | num_args | The number of arguments. |
| [in] | num_fixed_args | The number of non-variadic arguments. |
| [in] | target_function | The address of the C function to call. |
Creates a bound forward trampoline from infix_type objects.
This is the lower-level, programmatic way to create a bound forward trampoline. It bypasses the signature string parser, making it suitable for performance-critical applications or language bindings that construct type information dynamically.
All infix_type objects passed to this function must be fully resolved and have a valid layout. They should be allocated from a user-managed infix_arena_t.
| [out] | out_trampoline | Receives the created trampoline handle. |
| [in] | return_type | The infix_type for the function's return value. |
| [in] | arg_types | An array of infix_type* for the function's arguments. |
| [in] | num_args | The number of arguments. |
| [in] | num_fixed_args | The number of non-variadic arguments. |
| [in] | target_function | The address of the C function to call. |
| INFIX_API INFIX_NODISCARD infix_status infix_forward_create_unbound_manual | ( | infix_forward_t ** | out_trampoline, |
| infix_type * | return_type, | ||
| infix_type ** | arg_types, | ||
| size_t | num_args, | ||
| size_t | num_fixed_args ) |
Creates an unbound forward trampoline from infix_type objects.
| [out] | out_trampoline | Receives the created trampoline handle. |
| [in] | return_type | The infix_type for the function's return value. |
| [in] | arg_types | An array of infix_type* for the function's arguments. |
| [in] | num_args | The number of arguments. |
| [in] | num_fixed_args | The number of non-variadic arguments. |
Creates an unbound forward trampoline from infix_type objects.
This is the lower-level, programmatic way to create an unbound forward trampoline. It bypasses the signature string parser.
| [out] | out_trampoline | Receives the created trampoline handle. |
| [in] | return_type | The infix_type for the function's return value. |
| [in] | arg_types | An array of infix_type* for the function's arguments. |
| [in] | num_args | The number of arguments. |
| [in] | num_fixed_args | The number of non-variadic arguments. |
| INFIX_API void infix_forward_destroy | ( | infix_forward_t * | trampoline | ) |
Destroys a forward trampoline and frees all associated memory.
| [in] | trampoline | The trampoline to destroy. Safe to call with nullptr. |
This function safely releases all resources owned by the trampoline, including its JIT-compiled executable code and its private memory arena which stores the deep-copied type information.
| [in] | trampoline | The trampoline to destroy. Safe to call with nullptr. |
| INFIX_API INFIX_NODISCARD infix_status infix_reverse_create_callback_manual | ( | infix_reverse_t ** | out_context, |
| infix_type * | return_type, | ||
| infix_type ** | arg_types, | ||
| size_t | num_args, | ||
| size_t | num_fixed_args, | ||
| void * | user_callback_fn ) |
Creates a type-safe reverse trampoline (callback) from infix_type objects.
| [out] | out_context | Receives the created context handle. |
| [in] | return_type | The function's return type. |
| [in] | arg_types | An array of argument types. |
| [in] | num_args | The number of arguments. |
| [in] | num_fixed_args | The number of non-variadic arguments. |
| [in] | user_callback_fn | A pointer to the type-safe C handler function. |
Creates a type-safe reverse trampoline (callback) from infix_type objects.
| [out] | out_context | Receives the created context handle. |
| [in] | return_type | The function's return type. |
| [in] | arg_types | An array of argument types. |
| [in] | num_args | The number of arguments. |
| [in] | num_fixed_args | The number of non-variadic arguments. |
| [in] | user_callback_fn | A pointer to the type-safe C handler function. |
| INFIX_API INFIX_NODISCARD infix_status infix_reverse_create_closure_manual | ( | infix_reverse_t ** | out_context, |
| infix_type * | return_type, | ||
| infix_type ** | arg_types, | ||
| size_t | num_args, | ||
| size_t | num_fixed_args, | ||
| infix_closure_handler_fn | user_callback_fn, | ||
| void * | user_data ) |
Creates a generic reverse trampoline (closure) from infix_type objects.
| [out] | out_context | Receives the created context handle. |
| [in] | return_type | The function's return type. |
| [in] | arg_types | An array of argument types. |
| [in] | num_args | The number of arguments. |
| [in] | num_fixed_args | The number of non-variadic arguments. |
| [in] | user_callback_fn | A pointer to the generic infix_closure_handler_fn. |
| [in] | user_data | A void* pointer to application-specific state. |
Creates a generic reverse trampoline (closure) from infix_type objects.
| [out] | out_context | Receives the created context handle. |
| [in] | return_type | The function's return type. |
| [in] | arg_types | An array of argument types. |
| [in] | num_args | The number of arguments. |
| [in] | num_fixed_args | The number of non-variadic arguments. |
| [in] | user_callback_fn | A pointer to the generic infix_closure_handler_fn. |
| [in] | user_data | A void* pointer to application-specific state. |
| INFIX_API void infix_reverse_destroy | ( | infix_reverse_t * | reverse_trampoline | ) |
Destroys a reverse trampoline and frees all associated memory.
| [in] | reverse_trampoline | The reverse trampoline context to destroy. Safe to call with nullptr. |
This function safely releases all resources owned by the reverse trampoline, including its JIT-compiled stub, its private memory arena, the cached forward trampoline (if any), and the special read-only memory region for the context itself.
| [in] | reverse_trampoline | The reverse trampoline context to destroy. Safe to call with nullptr. |