This is a reference to the standard filenames and extensions used by various parts of the OCaml build system.
Note: There is an extended mailing list posting about filenames used by OCaml here.
The basic source, object and binary files, with comparisons to C programming:
Purpose | C | Bytecode | Native code |
---|---|---|---|
Source code | *.c | *.ml | *.ml |
Header files1 | *.h | *.mli | *.mli |
Object files | *.o | *.cmo | *.cmx2 |
Library files | *.a | *.cma | *.cmxa3 |
Binary programs | prog | prog | prog.opt4 |
Foo
you will find two files: foo.ml
and foo.mli
. foo.ml
is the implementation and foo.mli
is the interface or signature. uTF8.mli
which is the signature of a module called UTF8
.*.cmi
files are intermediate files which are compiled forms of the .mli
(interface or "header file").
To produce them, just compile the .mli
file:
ocamlc -c foo.mli