Compiling ocaml project to call from C using Dune

c
dune

#1

Hello, i need your help.
I’m currently trying to test ocaml library with C unit tests.
What i need is to get .o(object) files from ocaml code to link them with c unit tests, preferably using dune but if it’s not possible any other way will do.
I already know that ocamlc -output-obj is a way to do it but can’t force dune to do this for me, it seems like it can only compile to binary or library and that’s all.
Please help, if you need further information, please ask and i’ll answer you as fast as i can.


#2

Could you have a look at https://dune.readthedocs.io/en/latest/dune-files.html#linking-modes and see if that helps? In particular, you might be interested in the object linking mode