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.
Source and object files
The basic source, object and binary files, with comparisons to C programming:
- In C the header files describe the functions, etc., but only by
convention. In OCaml, the *.mli file is the exported signature of
the module, and the compiler strictly
In most cases for a module called
Fooyou will find two files:
foo.mlis the implementation and
foo.mliis the interface or signature.
Notice also that the first letter of the file is turned to uppercase to get the module name. For example, Extlib contains a file called
uTF8.mliwhich is the signature of a module called
- There is also a corresponding *.o file which contains the actual machine code, but you can usually ignore this file.
- There is also a corresponding *.a file which contains the actual machine code, but you can usually ignore this file.
- This is the convention often used by OCaml programs, but in fact you can name binary programs however you want.
*.cmi files are intermediate files which are compiled forms of the
.mli (interface or "header file").
To produce them, just compile the
ocamlc -c foo.mli