Dune makes it very easy to build shared objects (*.so) so that OCaml libraries can be used from C. You can see a minimal example here. To give you an overview of this example, here is the dune file for the shared library: (library (name lib) (public_name binding-example) (modules lib)) (executable (name CAPI) (libraries binding-example) (foreign_stubs (language c) (names cstub)) (flags :standard -linkall) (modes (native shared_object)) (modules CAPI)) (install (section lib) (files ...