I'm working on a build tool that analyzes the opam lib dir (e.g. ~/.opam/4.09/0/lib
). Most of the subdirs there contain (mostly) compiled code - cmx, cma, etc. But some of them contain source code; for example, zarith contains an .mli
file for each cm file, pluszarith.h
. The ocaml subdir contains a lot of source code.
My understanding is that the .mli
files are needed because they play a role in resolution of module refs. But what about the .ml
files? Why are they there? Can I safely ignore them?
A followup question. Some of the subdirs contain .cmt
and/or .cmti
files. The tool I'm developing is only for compiling/linking. My understanding is that such files play no role in compile/link, so I can safely ignore them. Is that correct?
Gregg Reynolds said:
A followup question. Some of the subdirs contain
.cmt
and/or.cmti
files. The tool I'm developing is only for compiling/linking. My understanding is that such files play no role in compile/link, so I can safely ignore them. Is that correct?
This answer seems to agree with you: https://stackoverflow.com/questions/53218683/whats-use-of-cmt-file-in-ocaml
great, thanks.
Hi @Gregg Reynolds , indeed I think that .ml and .cmt files are meant for developing, so for example jump-to-definition works correctly from editors, etc... Dune-based projects for example will install them, but this is not true of other build systems.
I am not sure what the current "official" policy is regarding installing these files, I guess people over https://discuss.ocaml.org/ may know more than us.
Last updated: Oct 13 2024 at 01:02 UTC