not logged in | [Login]
While binding to C APIs that need callbacks is fine most of the time, occasionally you will hit a rare case where the API needs features that the FFI does not yet support - specifically, callback signatures with varargs or pass-by-value aggregates.
Please list examples here as you encounter them.
Implementing the IDropTarget COM interface requires methods that need pass-by-value POINTL struct parameters.
cpSpaceNearestPointQuery and cpSpaceSegmentQuery require callbacks with pass-by-value cpVect struct parameters.
uv_read_start requires uv_read_cb callback with pass-by-value uv_buf_t struct parameter. There is an open discussion with a proposal to change it.
clang_visitChildren requires callbacks to receive CXCursor by value.
Please see this example for how to overcome this: FFI Callbacks with pass-by-value structs
retro_log_printf_t takes log level, format and varargs to be presented to e g vsnprintf.
Vararg callbacks don't work so there's no way to set this function from luajit (?).
NSView.drawRect:
NSWindow.windowShouldZoom:toFrame:
NSWindow.windowWillResize:toSize: