Inside F#

Brian's thoughts on F# and .NET

Quick aside: F# CTP compiler flags (command-line options)

Posted by Brian on September 6, 2008

One thing that changed in the CTP release of F# is the names of various compiler options.  Below is a brief table that shows the old names and new names of many command-line flags. 

Old flag New flag
-i  /  –generate-interface-file –sig
-doc –doc
-Ooff –optimize-
-O0, 01, etc –optimize
–warn –warnaserror[+|-] <int list>
–all-warnings-as-errors –warnaserror
–warn-as-error <int> –warnaserror <int>
–utf8-output –utf8output
–clr-root –cliroot
–target-exe –target exe
–target-winexe –target winexe
–target-dll –target library
–target-module –target module
–static-link –staticlink
–public-keyfile –keyfile <file> –delaysign
–link-resource –linkresource
–base-address –baseaddress
–generate-debug-file / –no-debug-file –debug / –debug –pdbonly
–generate-html –generatehtml
–html-output-directory –htmloutputdir
–html-css –htmlcss
–html-namespace-file –htmlnamespacefile
–html-namespace-file-append –htmlnamespacefileappend
–no-framework –noframework
–all-tailcalls –optimize
–no-tailcalls –optimize- notailcalls

As with a number of other changes in the CTP, these changes were to make things more regular and consistent with other Visual Studio languages.  The compiler help itself also now displays in a format similar to that of the C# and VB compilers (csc.exe and vbc.exe); here’s the output of "fsc.exe /?":

Microsoft F# Compiler, (c) Microsoft Corporation, All Rights Reserved
F# Version, compiling for .NET Framework Version v2.0.50727

                – OUTPUT FILES –
–out <string>                Name of the output file (Short form: -o)
–target exe <string>         Build an executable with a console
–target winexe <string>      Build an executable without a stdin/stdout/stderr
–target library <string>     Build a library (Short form: -a)
–target module <string>      Build a module that can be added to another
–delaysign[+|-]              Delay-sign the assembly using only the public
                              portion of the strong name key
–doc <string>                Write the xmldoc of the assembly to the given
–keyfile <string>            Specify a strong name key file
–platform <string>           Limit which platforms this code can run on:
                              x86, Itanium, x64 or anycpu. The default is
–nooptimizationdata          Only include optimization information essential
                              for implementing inlined constructs. Inhibits
                              cross-module inlining but improves binary
–nointerfacedata             Don’t add a resource to the generated assembly
                              containing F#-specific metadata
–sig <string>                Print the inferred interface of the assembly
                              to a file

                – INPUT FILES –
–reference <string>          Reference an F# or .NET assembly (Short form: -r)

                – RESOURCES –
–win32res <string>           Specify a Win32 resource file (.res)
–resource <string>           Embed the specified managed resource
–linkresource <string>       Link the specified resource to this assembly
                              where the resinfo format is
                                  <file>[,<string name>[,public|private]]

                – CODE GENERATION –
–debug[+|-]                  Emit debug information (Short form: -g)
–debug <string>              Specify debugging type: full, pdbonly. default,
                              (‘full’ is the default and enables attaching a
                              debugger to a running program)
–optimize[+|-]               Enable optimizations (Short form: -O)
–optimize[+|-] <string list> Control specific optimizations (Short form: -O)
                              The following optimizations may be selectively
                              enabled or disabled: nojitoptimize,
                              nojittracking, nolocaloptimize, nocrossoptimize,

                – ERRORS AND WARNINGS –
–warnaserror[+|-]            Report all warnings as errors
–warnaserror[+|-] <int list> Report specific warnings as errors
–warn <int>                  Set a warning level (0-4)
–nowarn <string list>        Disable specific warning messages

                – LANGUAGE –
–checked[+|-]                Generate overflow checks
–define <string>             Define conditional compilation symbols (Short
                              form: -d)
–mlcompatibility             Ignore OCaml-compatibility warnings.

                – HTML –
–generatehtml                Generate HTML documentation
–htmloutputdir <string>      Output directory for HTML documentation
–htmlcss <string>            Set the name of the Cascading Style Sheet
–htmlnamespacefile <string>  Set the name of the master namespaces.html
                              file assumed to be in the output directory
–htmlnamespacefileappend     Append to the master namespace file when
                              generating HTML documentation

                – MISCELLANEOUS –
–nologo                      Don’t show the splash text on startup
–help                        Display this usage message (Short form: -?)

                – ADVANCED –
–baseaddress <string>        Base address for the library to be built
–codepage <int>              Specify the codepage used to read source files
–utf8output                  Output compiler messages in UTF-8 encoding
–fullpaths                   Compiler generates fully qualified paths
–cliroot <string>            Use to override where the compiler looks for
                              mscorlib.dll and framework components
–cliversion <string>         Version of the framework to target (for
                              example, 2.0, 3.0 or 3.5). The default is 2.0
–noframework                 Do not reference the .NET Framework assemblies
                              by default
–times                       Display timing profiles for compilation
–standalone                  Statically link the F# library and all
                              referenced DLLs that depend on it into the
                              assembly being generated.
–staticlink <string>         Statically link the given assembly and all
                              referenced DLLs that depend on this assembly.
                              Use an assembly name e.g. mylib, not a DLL name
–pdb <string>                Name the output debug file
–lib <string list>           Specify a directory for the include path (Short
                              form: -I)

By the way, you might notice the version number is – yesterday we released a minor update to the CTP with a few high priority fixes.  Thanks again to everyone who has given great feedback on the CTP release!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: