Feedback on FFI Callbacks article

(also posted on Reddit)

As part of the ongoing rewrite of my FFI guide, I’ve just finished writing the “Callbacks” chapter and was wondering if I could get some feedback on it.

In particular,

  • Do you think the chapter adequately explains how to pass around callbacks in FFI?
  • Are there any bugs in the code examples? (bonus points for finding UB!)
  • If you’ve needed to use callbacks in FFI code in the past, are there any pain points or tips I should talk about?