Build an object file (.cmx/.o file) and its associated compiled
interface (.cmi) that combines the .cmx object
files given on the command line, making them appear as sub-modules of
the output .cmx file. The name of the output .cmx file must be
given with the -o option. For instance,
ocamlopt -pack -o P.cmx A.cmx B.cmx C.cmx
generates compiled files P.cmx, P.o and P.cmi describing a
compilation unit having three sub-modules A, B and C,
corresponding to the contents of the object files A.cmx, B.cmx and
C.cmx. These contents can be referenced as P.A, P.B and P.C
in the remainder of the program.
The .cmx object files being combined must have been compiled with
the appropriate -for-pack option. In the example above,
A.cmx, B.cmx and C.cmx must have been compiled with
ocamlopt -for-pack P.
Multiple levels of packing can be achieved by combining -pack with
-for-pack. Consider the following example:
ocamlopt -for-pack P.Q -c A.ml
ocamlopt -pack -o Q.cmx -for-pack P A.cmx
ocamlopt -for-pack P -c B.ml
ocamlopt -pack -o P.cmx Q.cmx B.cmx
The resulting P.cmx object file has sub-modules P.Q, P.Q.A
and P.B.