Ctypes failing to find functions at runtime

I’m trying to create bindings to a C library using CTypes. So far everything compiles correctly, I’ve got all the dune config set up and working AFAIK. But when I try to run a trivial example, OCaml can’t find the functions in the C lib. Does anyone know what could be causing this?

I suspect runtime linking is failing, and that it’s because it’s looking for functions named, for example, “foo” as opposed to “_foo” which is what I see in the binary of the lib I’m wrapping.

For context, I am on MacOS (which iirc, mangles all symbols to start with “_”) and the library was installed using homebrew. I would like my lib to be cross-platform (the C lib is) at some point but my first priority is just getting it to work at all.

If it’s helpful, here’s the link to my OCaml lib

did you ever figure this out? currently facing the same issue