[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MIT-Scheme-devel] FFI callbacks as struct members

From: Joel Gustafson
Subject: [MIT-Scheme-devel] FFI callbacks as struct members
Date: Thu, 11 May 2017 08:27:52 +0000

Hello all!
I'm trying to writing bindings for libsoundio (, 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?

Thanks and hello,
- Joel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]