Add `void*` params to callbacks, for caller context
snej opened this issue · comments
In general, most C APIs that register callbacks have a void*
parameter in the callback, and in the function that registers it, for passing arbitrary client state. Otherwise the callback implementation can only access global state.
Mir’s API lacks this. So for example, I’ve found the function MIR_write_with_func
almost unusable because my callback doesn’t know where to put the data given to it; I’d have to create a global/static variable pointing to my data buffer.
The functions that take such callbacks are:
MIR_set_error_func
MIR_write_with_func
MIR_write_module_with_func
MIR_read_with_func
MIR_link
(at least for theimport_resolver
)