infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
Public API

The primary public-facing functions for using the infix library. More...

Collaboration diagram for Public API:

Modules

 High-Level Signature API
 Recommended functions for creating trampolines from a signature string.
 
 Manual Type-Creation API
 Advanced functions for manually building infix_type objects.
 
 Named Type Registry API
 Functions for defining, managing, and using a registry of named types.
 
 Type System
 Structures and functions for describing C data types.
 
 Introspection API
 Functions for querying the properties of trampolines and types.
 
 Memory Management
 The arena allocator and configurable memory functions.
 
 Error Reporting
 Public structures and enumerations for detailed error reporting.
 
 Dynamic Library & Globals API
 Functions for interacting with shared libraries and their global variables.
 
 Version Information
 Macros defining the semantic version of the infix library.
 
 Dynamic Library API
 Functions for loading shared libraries and looking up symbols.
 

Typedefs

typedef void(* infix_unbound_cif_func) (void *, void *, void **)
 The signature for a generic "unbound" forward-call trampoline.
 
typedef void(* infix_cif_func) (void *, void **)
 The signature for a "bound" forward-call trampoline.
 
typedef void(* infix_closure_handler_fn) (infix_context_t *context, void *return_value, void **args)
 The signature for a generic "closure" handler.
 

Enumerations

enum  infix_status {
  INFIX_SUCCESS = 0 , INFIX_ERROR_ALLOCATION_FAILED , INFIX_ERROR_INVALID_ARGUMENT , INFIX_ERROR_UNSUPPORTED_ABI ,
  INFIX_ERROR_LAYOUT_FAILED , INFIX_ERROR_PROTECTION_FAILED , INFIX_ERROR_
}
 An enumeration of all possible success or failure codes from the public API. More...
 

Detailed Description

The primary public-facing functions for using the infix library.

Typedef Documentation

◆ infix_cif_func

typedef void(* infix_cif_func) (void *, void **)

The signature for a "bound" forward-call trampoline.

This is the function pointer type returned by infix_forward_get_code. The target function is hardcoded, so it is not needed as an argument at the call site.

Parameters
return_valueA pointer to a buffer where the return value will be stored.
argsAn array of pointers, where each element points to an argument's value.
Example: Calling a function int add(int a, int b)
int a = 10, b = 20;
int result;
// The args array must contain pointers to the actual argument values.
void* my_args[] = { &a, &b };
cif(&result, my_args);
// `result` now contains 30.
c23_nodiscard infix_cif_func infix_forward_get_code(infix_forward_t *)
Retrieves the executable code pointer from a bound forward trampoline.
Definition trampoline.c:227
void(* infix_cif_func)(void *, void **)
The signature for a "bound" forward-call trampoline.
Definition infix.h:335

◆ infix_closure_handler_fn

typedef void(* infix_closure_handler_fn) (infix_context_t *context, void *return_value, void **args)

The signature for a generic "closure" handler.

This function pointer type is used with infix_reverse_create_closure. It is a low-level handler ideal for language bindings, receiving all arguments in a generic void** array for manual marshalling.

Parameters
contextThe context handle of the invoked callback.
return_valueA pointer to a buffer where the handler must write the return value.
argsAn array of pointers to the arguments passed by the native caller.

◆ infix_unbound_cif_func

typedef void(* infix_unbound_cif_func) (void *, void *, void **)

The signature for a generic "unbound" forward-call trampoline.

This is the function pointer type returned by infix_forward_get_unbound_code. It provides a standardized way to invoke any C function for which a trampoline was generated.

Parameters
target_functionA pointer to the native C function to be called.
return_valueA pointer to a buffer where the return value will be stored.
argsAn array of pointers, where each element points to an argument's value.

Enumeration Type Documentation

◆ infix_status

An enumeration of all possible success or failure codes from the public API.

Enumerator
INFIX_SUCCESS 

The operation completed successfully.

INFIX_ERROR_ALLOCATION_FAILED 

A memory allocation request failed.

INFIX_ERROR_INVALID_ARGUMENT 

An invalid argument was provided to a function.

INFIX_ERROR_UNSUPPORTED_ABI 

The current platform/ABI is not supported.

INFIX_ERROR_LAYOUT_FAILED 

Failed to calculate the call frame layout.

INFIX_ERROR_PROTECTION_FAILED 

Failed to change memory permissions (e.g., mprotect or VirtualProtect).

INFIX_ERROR_ 

An unspecified error occurred.