|
libclap 1.0.0
Command Line Argument Parser for C
|
Custom memory allocator support. More...


Go to the source code of this file.
Functions | |
| CLAP_EXPORT void | clap_set_allocator (void *(*malloc_fn)(size_t), void(*free_fn)(void *), void *(*realloc_fn)(void *, size_t)) |
| Set custom memory allocator functions. | |
Custom memory allocator support.
| CLAP_EXPORT void clap_set_allocator | ( | void *(*)(size_t) | malloc_fn, |
| void(*)(void *) | free_fn, | ||
| void *(*)(void *, size_t) | realloc_fn | ||
| ) |
Set custom memory allocator functions.
All subsequent allocations (internal buffers, namespace entries, etc.) use these callbacks. Must be called before any other libclap function — once parsing begins the allocator is locked in.
| malloc_fn | Allocation callback, must match malloc() semantics. Must not be NULL. |
| free_fn | Deallocation callback, must match free() semantics. Must not be NULL. |
| realloc_fn | Reallocation callback, must match realloc() semantics. Pass NULL if not needed (libclap falls back to malloc+copy+free internally). |