Ocaml基本认识

来源:互联网 发布:php curl 上传图片 编辑:程序博客网 时间:2024/05/21 15:48

1、Ocaml概述

Starting with OCaml 3.05, there are no less than three ports of
Objective Caml for MS Windows available:
  - a native Win32 port, built with the Microsoft development tools;
  - a native Win32 port, built with the Cygwin/MinGW development tools;
  - a port consisting of the Unix sources compiled under the Cygwin
    Unix-like environment for Windows.

Here is a summary of the main differences between these ports:

                                      Native MS     Native MinGW        Cygwin
Third-party software required
  - for base bytecode system            none            none            none
  - for ocamlc -custom                  MSVC            Cygwin          Cygwin
  - for native-code generation          MSVC+MASM       Cygwin          Cygwin

Speed of bytecode interpreter           70%             100%            100%

Replay debugger                         no              no              yes

The Unix library                        partial         partial         full

The Threads library                     yes             yes             yes

The Graphics library                    yes             yes             no

Restrictions on generated executables?  none            none            yes (*)

2、win下ocamlc的相关选项

Usage: ocamlc <options> <files>
Options are:
  -a  Build a library
  -c  Compile only (do not link)
  -cc <command>  Use <command> as the C compiler and linker
  -cclib <opt>  Pass option <opt> to the C linker
  -ccopt <opt>  Pass option <opt> to the C compiler and linker
  -custom  Link in custom mode
  -dllib <lib>  Use the dynamically-loaded library <lib>
  -dllpath <dir>  Add <dir> to the run-time search path for shared libraries
  -dtypes  Save type information in <filename>.annot
  -g  Save debugging information
  -i  Print inferred interface
  -I <dir>  Add <dir> to the list of include directories
  -impl <file>  Compile <file> as a .ml file
  -intf <file>  Compile <file> as a .mli file
  -intf-suffix <string>  Suffix for interface files (default: .mli)
  -intf_suffix <string>  (deprecated) same as -intf-suffix
  -labels  Use commuting label mode
  -linkall  Link all modules, even unused ones
  -make-runtime  Build a runtime system with given C objects and libraries
  -make_runtime  (deprecated) same as -make-runtime
  -modern  (deprecated) same as -labels
  -noassert  Don't compile assertion checks
  -noautolink  Don't automatically link C libraries specified in .cma files
  -nolabels  Ignore non-optional labels in types
  -nostdlib  do not add default directory to the list of include directories
  -o <file>  Set output file name to <file>
  -output-obj  Output a C object file instead of an executable
  -pack  Package the given .cmo files into one .cmo
  -pp <command>  Pipe sources through preprocessor <command>
  -principal  Check principality of type inference
  -rectypes  Allow arbitrary recursive types
  -thread  Generate code that supports the system threads library
  -unsafe  No bounds checking on array and string access
  -use-runtime <file>  Generate bytecode for the given runtime system
  -use_runtime <file>  (deprecated) same as -use-runtime
  -v  Print compiler version and location of standard library and exit
  -version  Print compiler version and exit
  -verbose  Print calls to external commands
  -vmthread  Generate code that supports the threads library with VM-level scheduling
  -w <flags>  Enable or disable warnings according to <flags>:
     A/a enable/disable all warnings
     C/c enable/disable suspicious comment
     D/d enable/disable deprecated features
     E/e enable/disable fragile match
     F/f enable/disable partially applied function
     L/l enable/disable labels omitted in application
     M/m enable/disable overriden method
     P/p enable/disable partial match
     S/s enable/disable non-unit statement
     U/u enable/disable unused match case
     V/v enable/disable hidden instance variable
     X/x enable/disable all other warnings
     default setting is "Ale"
     (all warnings but labels and fragile match enabled)
  -warn-error <flags>  Treat the warnings enabled by <flags> as errors.
     See option -w for the list of flags.
     Default setting is "a" (warnings are not errors)
  -where  Print location of standard library and exit
  -nopervasives  (undocumented)
  -dparsetree  (undocumented)
  -drawlambda  (undocumented)
  -dlambda  (undocumented)
  -dinstr  (undocumented)
  -use-prims <file>  (undocumented)
  - <file>  Treat <file> as a file name (even if it starts with `-')
  -help  Display this list of options
  --help  Display this list of options

原创粉丝点击