#ObjC block

1 messages · Page 1 of 1 (latest)

cobalt spruce
#

I want to wrap a MacOS framework API in Zig. There's one essential function that requires an ObjC block to call back. Here's the block's signature.

typedef void (^MIDIReceiveBlock)(const MIDIEventList *evtlist, void *srcConnRefCon);

Shall I add a .m as a dependency with a C API for this one element, or is there some other way to work around this? Maybe even in Zig?..
I imagine it's not impossible to recreate the block's memory layout, but it would be beyond my skills.

As the event loop is out of reach in the depths of MacOS and it's an event handler that should invoke a state change in the application, I reckon I must have it capture a pointer to push the evtlist into the app.

sour crow
#

You can call obj c in zig,