Bindings to Maude Solver - Need to dynamically link a .so file

Hi, I’ve already asked for help on reddit and the discord. I’m looking to link OCaml 4.14 programs with the Maude Solver using it’s SWIG bindings. The Maude folks have a cmake build system that generates a language-dependent .so file that can link against various other languages. For OCaml, SWIG also generates .ml and .mli files. I believe I have to include these OCaml files with the rest of a project and then link against the .so file, but I am confused on how to do this. I have tried several arrangements with dune following the foreign archives and foreign libraries pages, including specifying the .so file as a foreign_archive (although it’s a shared object file the documentation let me to believe this would work), but I can’t get dune to recognize the .so file. Additionally, I wasn’t able to get ocamlopt outside of dune to recognize the .so file despite the manual stating that it should be recognized (I get an error that it doesn’t know what to do with a .so file). Any guidance on what to do would be greatly appreciated. Thanks.

Linking with shared objects (which happens at runtime) is typically achieved by passing a flag of the form -lfoo (if your shared object is named or to the C linker. You can tell the OCaml compiler to pass a flag to the C linker with -cclib <flag>, eg -cclib -lfoo.

This is the general idea, the details can be more or less involved depending on your exact environment.