|
infix
A JIT-Powered FFI Library for C
|
Cookbook Chapter 3: Creating a Type-Safe Callback for qsort
More...
Functions | |
| static int | compare_integers_handler (const void *a, const void *b) |
| int | main () |
Cookbook Chapter 3: Creating a Type-Safe Callback for qsort
This example demonstrates a "reverse call" or callback. We generate a native C function pointer that can be passed to a C library function that expects one. Here, we use infix_reverse_create_callback to create a comparison function for the standard library's qsort.
The key feature of this API is that the handler function (compare_integers_handler) has a clean, type-safe C signature that exactly matches what qsort expects.
|
static |
| int main | ( | void | ) |