Download The Objective Caml system release 2.02 - The Caml language
Transcript
114 • Arguments ending in .cma are taken to be libraries of object bytecode. A library of object bytecode packs in a single file a set of object bytecode files (.cmo files). Libraries are built with ocamlc -a (see the description of the -a option below). The object files contained in the library are linked as regular .cmo files (see above), in the order specified when the .cma file was built. The only difference is that if an object file contained in a library is not referenced anywhere in the program, then it is not linked in. • Arguments ending in .c are passed to the C compiler, which generates a .o object file. This object file is linked with the program if the -custom flag is set (see the description of -custom below). • Arguments ending in .o or .a are assumed to be C object files and libraries. They are passed to the C linker when linking in -custom mode (see the description of -custom below). The output of the linking phase is a file containing compiled bytecode that can be executed by the Objective Caml bytecode interpreter: the command named ocamlrun. If caml.out is the name of the file produced by the linking phase, the command ocamlrun caml.out arg 1 arg 2 ... arg n executes the compiled code contained in caml.out, passing it as arguments the character strings arg 1 to arg n . (See chapter 9 for more details.) On most Unix systems, the file produced by the linking phase can be run directly, as in: ./caml.out arg 1 arg 2 ... arg n The produced file has the executable bit set, and it manages to launch the bytecode interpreter by itself. 7.2 Options The following command-line options are recognized by ocamlc. -a Build a library (.cma file) with the object files (.cmo files) given on the command line, instead of linking them into an executable file. The name of the library can be set with the -o option. The default name is library.cma. -c Compile only. Suppress the linking phase of the compilation. Source code files are turned into compiled files, but no executable file is produced. This option is useful to compile modules separately. -cc ccomp Use ccomp as the C linker called by ocamlc -custom and as the C compiler for compiling .c source files. -cclib -llibname Pass the -llibname option to the C linker when linking in “custom runtime” mode (see the -custom option). This causes the given C library to be linked with the program.