I wish to wrap a library where there is a function with the following type signature:
int fn_name(void (*cb)(*char, va_list));
I want the callback I pass to have access to some context in Rust. My idea was to create a closure with access to the context, and then convert this closure into an extern "C"
raw function pointer. I don't think this is going to work.
Is it possible to do what I am trying to do, and if so how do I do it?
Note that the function uses
va_list
fromstdarg.h
, but I'm happy to treat it as a*void
- handling that is out of scope of this question.