Filewatcher File Search File Search
Catalog
Content Search
» » » » » ocaml_1.03-2.deb » Content »
pkg://ocaml_1.03-2.deb:1136546/usr/man/man1/  info  control  downloads

ocaml - ML language implementation with a class-based object system.…  more info»

ocamlopt.1.gz

OCAMLOPT(1)                                              OCAMLOPT(1)



NAME
       ocamlopt - The Objective Caml native-code compiler



SYNOPSIS
       ocamlopt  [  -acivS  ] [ -cclib libname ] [ -ccopt option ] [
       -compact ] [ -unsafe ] [ -o exec-file ] [ -I lib-dir ]  file‐
       name ...


DESCRIPTION
       The  Objective  Caml  high-performance  native-code  compiler
       ocamlopt(1) compiles Caml source files to native code  object
       files  and link these object files to produce standalone exe‐
       cutables.

       The ocamlopt(1) command has  a  command-line  interface  very
       close  to  that  of  ocamlc(1).  It accepts the same types of
       arguments:

       Arguments ending in .mli are taken to  be  source  files  for
       compilation  unit  interfaces.  Interfaces  specify the names
       exported by compilation units: they declare value names  with
       their  types, define public data types, declare abstract data
       types, and so on. From the file x.mli, the  ocamlopt(1)  com‐
       piler  produces  a compiled interface in the file x.cmi.  The
       interface produced is identical to that produced by the byte‐
       code compiler ocamlc(1).

       Arguments ending in .ml are taken to be source files for com‐
       pilation unit implementations. Implementations provide  defi‐
       nitions  for the names exported by the unit, and also contain
       expressions to be evaluated for their side-effects.  From the
       file  x.ml,  the  ocamlc(1) compiler produces two files: x.o,
       containing native object code, and  x.cmx,  containing  extra
       information  for  linking  and optimization of the clients of
       the  unit.  The  compiled  implementation  should  always  be
       referred to under the name x.cmx (when given a .o file, ocam‐
       lopt(1) assumes that it contains code compiled  from  C,  not
       from Caml).

       The  implementation  is  checked  against  the interface file
       x.mli  (if  it  exists)  as  described  in  the  manual   for
       ocamlc(1).

       Arguments  ending  in  .cmx  are  taken to be compiled object
       code.  These files are linked together, along with the object
       files  obtained  by compiling .ml arguments (if any), and the
       Caml Light standard library, to produce  a  native-code  exe‐
       cutable  program.  The  order in which .cmx and .ml arguments
       are presented on the command line  is  relevant:  compilation
       units  are initialized in that order at run-time, and it is a
       link-time error to use a component of a  unit  before  having
       initialized  it.  Hence,  a given x.cmx file must come before
       all .cmx files that refer to the unit x.

       Arguments ending in .cmxa are taken to be libraries of object
       code.  Such a library packs in two files lib.cmxa and lib.a a
       set of object files (.cmx/.o files). Libraries are build with
       ocamlopt -a (see the description of the -a option below). The
       object files contained in the library are linked  as  regular
       .cmx  files  (see  above),  in  the  order specified when the
       library 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.

       Arguments ending in .o or .a are assumed to be C object files
       and libraries. They are linked with the program.

       The  output of the linking phase is a regular Unix executable
       file. It does not need ocamlrun(1) to run.


OPTIONS
       The following command-line options are  recognized  by  ocam‐
       lopt(1).


       -a     Build  a library (.cmxa/.a file) with the object files
              (.cmx/.o 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.cmxa.


       -c     Compile only. Suppress the linking phase of the compi‐
              lation. Source code files  are  turned  into  compiled
              files, but no executable file is produced. This option
              is useful to compile modules separately.


       -cclib -llibname
              Pass the -llibname option to the linker.  This  causes
              the given C library to be linked with the program.


       -ccopt option
              Pass  the  given  option to the C compiler and linker.
              For instance, -ccopt -L dir causes  the  C  linker  to
              search for C libraries in directory dir.

              -compact  Optimize  the produced code for space rather
              than for time. This results in  smaller  but  slightly
              slower programs. The default is to optimize for speed.


       -i     Cause  the  compiler  to print all defined names (with
              their inferred types or their definitions)  when  com‐
              piling  an implementation (.ml file). This can be use‐
              ful to check the types inferred by the compiler. Also,
              since  the output follows the syntax of interfaces, it
              can help in writing an explicit interface (.mli  file)
              for  a  file: just redirect the standard output of the
              compiler to a .mli file, and edit that file to  remove
              all declarations of unexported names.


       -I directory
              Add  the  given  directory  to the list of directories
              searched for compiled interface files (.cmi) and  com‐
              piled  object  code files (.cmo). By default, the cur‐
              rent directory is searched first,  then  the  standard
              library  directory.  Directories  added  with  -I  are
              searched after the current directory, in the order  in
              which  they were given on the command line, but before
              the standard library directory.


       -o exec-file
              Specify the name of the output file  produced  by  the
              linker.  The  default output name is a.out, in keeping
              with the Unix tradition. If the -a  option  is  given,
              specify the name of the library produced.


       -S     Keep  the  assembly  code produced during the compila‐
              tion. The assembly code for the source  file  x.ml  is
              saved in the file x.s.


       -v     Print the version number of the compiler.


       -unsafe
              Turn  bound  checking off on array and string accesses
              (the v.(i) and s.[i]  constructs).  Programs  compiled
              with  -unsafe  are  therefore faster, but unsafe: any‐
              thing can happen if the program accesses an  array  or
              string outside of its bounds.


SEE ALSO
       ocamlc(1).
       The Objective Caml user's manual, chapter "Native-code compi‐
       lation".



                                                         OCAMLOPT(1)
Results 1 - 1 of 1
Help - FTP Sites List - Software Dir.
Search over 15 billion files
© 1997-2017 FileWatcher.com