With no arguments, MLton prints the version number and exits. For a usage message, run MLton with an invalid switch, e.g. mlton -z. In the explanation below and in the usage message, for flags that take a number of choices (e.g. {true|false} ), the first value listed is the default.
Options
-
-align {4|8}
-
-as-opt option
-
-cc-opt option
-
-codegen {native|bytecode|c}
-
-const 'name value'
-
Exn.keepHistory {false|true}
-
-default-ann ann
-
-disable-ann ann
-
Aligns object sizes and doubles in memory by the specified alignment. The default varies depending on architecture.
-
Pass option to gcc when assembling.
-
Pass option to gcc when compiling C code.
-
Generate native code, byte code, or C code. With -codegen native, MLton typically compiles more quickly and generates better code.
-
Set the value of a compile-time constant. Here is a list of available constants, their default values, and what they control.
-
Enable MLton.Exn.history. See MLtonExn for details. There is a performance cost to setting this to true, both in memory usage of exceptions and in run time, because of additional work that must be performed at each exception construction, raise, and handle.
-
Specify default ML Basis annotations. For example, -default-ann 'warnUnused true' causes unused variable warnings to be enabled by default. A default is overridden by the corresponding annotation in an ML Basis file.
-
Ignore the specified ML Basis annotation in every ML Basis file. For example, to see all match and unused warnings, compile with
-default-ann 'warnUnused true' -disable-ann forceUsed -disable-ann nonexhaustiveMatch -disable-ann redundantMatch -disable-ann warnUnused
-export-header file
-
Write to file C prototypes for all of the functions in the program exported from SML to C.
-ieee-fp {false|true}
-
Cause the native code generator to be pedantic about following the IEEE floating point standard. By default, it is not, because of the performance cost. This only has an effect with -codegen native.
-inline n
-
Set the inlining threshold used in the optimizer. The threshold is an approximate measure of code size of a procedure. The default is 320.
-keep {g|o|sml}
-
Save intermediate files. If no -keep argument is given, then only the output file is saved.
g | generated .S and .c files passed to gcc and the assembler |
o | object (.o) files |
sml | SML file |
-link-opt option
-
Pass option to gcc when linking. You can use this to specify library search paths, e.g. -link-opt -Lpath, and libraries to link with, e.g. -link-opt -lfoo, or even both at the same time, e.g. -link-opt '-Lpath -lfoo'. If you wish to pass an option to the linker, you must use gcc's -Wl, syntax, e.g., -link-opt '-Wl,--export-dynamic'.
-mlb-path-map file
-
Use file as an ML Basis path map to define additional MLB path variables. Multiple uses of -mlb-path-map are allowed, with variable definitions in later path maps taking precedence over earlier ones.
-output file
-
Specify the name of the final output file. The default name is the input file name with its suffix removed and an appropriate, possibly empty, suffix added.
-profile {no|alloc|count|time}
-
Produce an executable that gathers Profiling data. When such an executable is run, it produces an mlmon.out file.
-profile-branch {false|true}
-
If true, the profiler will separately gather profiling data for each branch of a function definition, case expression, and if expression.
-profile-stack {false|true}
-
If true, the executable will gather profiling data for all functions on the stack, not just the currently executing function. See ProfilingTheStack.
-runtime arg
-
Pass argument to the runtime system via @MLton. See RunTimeOptions. The argument will be processed before other @MLton command line switches. Multiple uses of -runtime are allowed, and will pass all the arguments in order. If the same runtime switch occurs more than once, then the last setting will take effect. There is no need to supply the leading @MLton or the trailing --; these will be supplied automatically.
An argument to -runtime may contain spaces, which will cause the argument to be treated as a sequence of words by the runtime. For example the command line:
mlton -runtime 'ram-slop 0.4' foo.sml
will cause foo to run as if it had been called like:
foo @MLton ram-slop 0.4 --
An executable created with -runtime stop doesn't process any @MLton arguments. This is useful to create an executable, e.g. echo, that must treat @MLton like any other command-line argument.
% mlton -runtime stop echo.sml % echo @MLton -- @MLton --
-show-basis file
-
Pretty print to file the basis defined by the input program. See ShowBasis.
-show-def-use file
-
Output def-use information to file. Each identifier that is defined appears on a line, followed on subsequent lines by the position of each use.
-stop {f|g|o|sml|tc}
-
Specify when to stop.
f | list of files on stdout (only makes sense when input is foo.cm or foo.mlb) |
g | generated .S and .c files |
o | object (.o) files |
sml | SML file (only makes sense when input is foo.cm or foo.mlb) |
tc | after type checking |
If you compile with -stop g or -stop o, you can resume compilation by running MLton on the generated .c and .S or .o files.
-target {self|...}
-
Generate an executable that runs on the specified platform. The default is self, which means to compile for the machine that MLton is running on. To use any other target, you must first install a cross compiler.
-target-as-opt target option
-
Like -as-opt, this passes option to gcc when assembling, except it only passes option when the target architecture or operating system is target. Valid values for target are: hppa, powerpc, sparc, x86, cygwin, darwin, freebsd, linux, mingw, netbsd, openbsd, solaris.
-target-cc-opt target option
-
Like -cc-opt, this passes option to gcc when compiling C code, except it only passes option when the target architecture or operating system is target. Valid values for target are as for -target-as-opt.
-target-link-opt target option
-
Like -link-opt, this passes option to gcc when linking, except it only passes option when the target architecture or operating system is target. Valid values for target are as for -target-as-opt.
-verbose {0|1|2|3}
-
How verbose to be about what passes are running. The default is 0.
0 | silent |
1 | calls to compiler, assembler, and linker |
2 | 1, plus intermediate compiler passes |
3 | 2, plus some data structure sizes |