I can use option of ocamlc -bin-annot to get a .cmt file,the doc told me it can "Dump detailed information about the compilation (types, bindings, tail-calls, etc) in binary format".
so how to use this .cmt file?I can't find information on web,I think I can go on use the .cmt file got a .cmo file or .out file?but direct use ocamlc test.cmt fail. So how to use the cmt file?Thanks!
The binary annotation files (aka .cmt
files) are a binary representation of the typedtree of the files (along with a few more data). Basically, they are meant for tools that want to inspect code without parsing and typing the files themselves.
As an example, I believe the wonderful tool merlin inspects the .cmt
files if they are present and uses those to perform its multiple tasks (printing types, auto-completion etc.).
If you are not writing a tool for OCaml, there is no point in trying to use those files. If you are writing a tool, welcome to the wonderful world of the compiler internals, where the documentation is pretty much reading the code.
As far as I know, there is no discussion to make .cmt
files compile (though it wouldn't be hard to implement). Mostly, there isn't much of a reason to do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With