I threw together notes from an ongoing project about writing code in OCaml and turning it into a shared library usable from C: https://transactional.blog/blog/2024-calling-ocaml-from-c
If there's any #OCaml folk around who have additional tips or advice in this area, I'd love to hear it.