DMD(1)

NAME
dmd - Digital Mars D2.x Compiler

SYNOPSIS
dmd files ... [ -switch ... ]

DESCRIPTION
dmd Compiles source code written in the D programming language.

OPTIONS

file, file.d, file.htm, file.html
    D source files to compile

file.di
    D interface files

file.o
    Object files to link in

file.a
    Library files to link in

@cmdfile
    A file to read more command-line arguments from, which may contain # single-line comments

-allinst
    Generate code for all template instantiations

-betterC
    Omit generating some runtime information and helper functions

-boundscheck=[on|safeonly|off]
    Bounds checks on, in @safe only, or off

-c  Compile only, do not link

-check=[assert|bounds|in|invariant|out|switch][=[on|off]]
    Enable or disable specific checks

-checkaction=D|C|halt
    Behavior on assert/boundscheck/finalswitch failure

-color
    Turn colored console output on

-color=[on|off|auto]
    Force colored console output on or off, or only when not redirected (default)

-conf=filename
    Use config file at filename

-cov
    Do code coverage analysis

-cov=nnn
    Require at least nnn% code coverage

-D  Generate documentation

-Dddirectory
    Write documentation file to directory

-Dffilename
    Write documentation file to filename

-d  Silently allow deprecated features and symbols

-dw Issue a message when deprecated features or symbols are used (default)

-de Issue an error when deprecated features or symbols are used (halt compilation)

-debug
    Compile in debug code

-debug=level
    Compile in debug code <= level

-debug=ident
    Compile in debug code identified by ident

-debuglib=name
    Set symbolic debug library to name

-defaultlib=name
    Set default library to name

-deps
    Print module dependencies (imports/file/version/debug/lib)

-deps=filename
    Write module dependencies to filename (only imports)

-dip25
    Implement https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP25.md

-dip1000
    Implement https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md

-dip1008
    Implement https://github.com/dlang/DIPs/blob/master/DIPs/DIP1008.md

-fPIC
    Generate position independent code

-g  Add symbolic debug info

-gf Emit debug info for all referenced types

-gs Always emit stack frame

-gx Add stack stomp code

-H  Generate 'header' file

-Hd=directory
    Write 'header' file to directory

-Hf=filename
    Write 'header' file to filename

--help
    Print help and exit

-I=directory
    Look for imports also in directory

-i[=pattern]
    Include imported modules in the compilation

-ignore
    Ignore unsupported pragmas

-inline
    Do function inlining

-J=directory
    Look for string imports also in directory

-L=linkerflag
    Pass linkerflag to link

-lib
    Generate library rather than object files

-m32
    Generate 32 bit code

-m64
    Generate 64 bit code

-main
    Add default main() (e.g. for unittesting)

-man
    Open web browser on manual page

-map
    Generate linker .map file

-mcpu=id
    Generate instructions for architecture identified by id

-mcpu=?
    List all architecture options

-mixin=filename
    Expand and save mixins to file specified by filename

-mv=package.module=<filespec>
    Use <filespec> as source file for package.module

-noboundscheck
    No array bounds checking (deprecated, use -boundscheck=off)

-O  Optimize

-o- Do not write object file

-od=directory
    Write object & library files to directory

-of=filename
    Name output file to filename

-op Preserve source path for output files

-profile
    Profile runtime performance of generated code

-profile=gc
    Profile runtime allocations

-release
    Compile release version

-run
    Compile, link, and run the program srcfile

-shared
    Generate shared library (DLL)

-transition=id
    Help with language change identified by id

-transition=?
    List all language changes

-unittest
    Compile in unit tests

-v  Verbose

-vcolumns
    Print character (column) numbers in diagnostics

-verrors=num
    Limit the number of error messages (0 means unlimited)

-verrors=spec
    Show errors from speculative compiles such as __traits(compiles,...)

--version
    Print compiler version and exit

-version=level
    Compile in version code >= level

-version=ident
    Compile in version code identified by ident

-vgc
    List all gc allocations including hidden ones

-vtls
    List all variables going into thread local storage

-w  Warnings as errors (compilation will halt)

-wi Warnings as messages (compilation will continue)

-X  Generate JSON file

-Xf=filename
    Write JSON file to filename

TRANSITIONS
Language changes listed by -transition=id:

field,3449
    List all non-mutable fields which occupy an object instance

import,10378
    Revert to single phase name lookup

dtorfields,14246
    Destruct fields of partially constructed objects

checkimports
    Give deprecation messages about 10378 anomalies

complex,14488
    Give deprecation messages about all usages of complex or imaginary types

intpromote,16997
    Fix integral promotions for unary + - ~ operators

tls List all variables going into thread local storage

fixAliasThis
    When a symbol is resolved, check alias this scope before going to upper scopes

markdown
    Enable Markdown replacements in Ddoc

vmarkdown
    List instances of Markdown replacements in Ddoc

LINKING
Linking is done directly by the dmd compiler after a successful compile. To prevent dmd from running the linker, use the -c switch.

The actual linking is done by running gcc. This ensures compatibility with modules compiled with gcc.

FILES
/etc/dmd.conf dmd will look for the initialization file dmd.conf in the directory /etc. If found, environment variable settings in the file will override any existing settings.

ENVIRONMENT
The D compiler dmd uses the following environment variables:

DFLAGS
    The value of DFLAGS is treated as if it were appended on the command line to dmd.

AUTHOR
Copyright (c) 1999-2019 by The D Language Foundation written by Walter Bright

ONLINE DOCUMENTATION
https://dlang.org/dmd.html (https://dlang.org/dmd.html)

SEE ALSO
dmd.conf(5) rdmd(1) dumpobj(1) obj2asm(1) gcc(1)