Hello all!
I'm trying to writing bindings for libsoundio (
http://libsound.io), and am struggling with callbacks. Callbacks in libsoundio are members of structs, while all of the MIT Scheme FFI callback examples pass callbacks as arguments into functions.
Specifically, there's a struct OutStream that has a member write_callback that I need to set.
struct OutStream {
...
void *userdata;
void (*write_callback)(struct OutStream *, int min, int max);
...
}
In the libsoundio examples it's done directly with outstream->write_callback = write_callback;
How can I declare and set a Scheme callback in a struct like this?