Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add void* params to callbacks, for caller context #356

Open
snej opened this issue Jul 31, 2023 · 0 comments
Open

Add void* params to callbacks, for caller context #356

snej opened this issue Jul 31, 2023 · 0 comments

Comments

@snej
Copy link

snej commented Jul 31, 2023

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 the import_resolver)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant