Plasma GitLab Archive
Projects Blog Knowledge

Why do some people install the .cmx files?

In principle, it is not necessary to install the .cmx files created by the ocamlopt compiler, as the .a and .cmxa files already contain the assembly code and all needed auxiliary information. However, it may be sensible to install the .cmx files, too. They contain the intermediate code of small functions that are candidates for inlining, and installing them allows the compiler to do inlining even across library boundaries. Note that only very small functions can be inlined at all, and that there are language elements that prevent inlining (e.g. raising an exception with an argument), so it makes only sense when the library actually has such functions and really profits from inlining.

Inlining has also disadvantages: The library can no longer be replaced by a different version even if the interface remains exactly the same, because code using the library may have inlined code of the old version.

This web site is published by Informatikb├╝ro Gerd Stolpmann
Powered by Caml