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

-color[=on|off]
    Force colored console output on or off

-conf=path
    Use config file at path

-cov
    Include code coverage analysis

-cov=nnn
    Require at least nnn% code coverage

-D  Generate documentation

-Dddocdir
    Write documentation file to docdir directory

-Dffilename
    Write documentation file to filename

-d  Silently allow deprecated features.

-dw Show use of deprecated features as warnings (default).

-de Show use of deprecated features as errors (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 the symbolic debug library to name

-defaultlib=name
    Set the default library to name

-deps=filename
    Write module dependencies to filename

-fPIC
    Generate position independent code.

-dip25
    Implement http://wiki.dlang.org/DIP25 (experimental)

-g  Add symbolic debug info.

-gc Add symbolic debug info in C format (for older gdb's.)

-gs Always emit stack frame.

-gx Add stack stomp code.

-H  Generate D interface file.

-Hddir
    Write D interface file to dir directory.

-Hffilename
    Write D interface file to filename

--help
    Print help

-Ipath
    Where to look for imports. path is a : separated list of paths. Multiple -I s can be used, and the paths are searched in the same order.

-ignore
    Ignore unsupported pragmas

-inline
    Inline expand functions

-Jpath
    Where to look for string imports. path is a : separated list of paths. Multiple -J s can be used, and the paths are searched in the same order.

-Llinkerflag
    Pass linkerflag to the linker, for example, -M

-lib
    Generate a library rather than object files

-m32
    Generate 32 bit code

-m64
    Generate 64 bit code

-man
    Open web browser on manual page

-map
    Generate linker .map file

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

-O  Optimize

-o- Suppress generation of object file

-odobjdir
    write object files relative to directory objdir instead of the current directory

-offilename
    set output file name to filename in the output directory

-op normally the path for .d source files is stripped off when generating an object file name. -op will leave it on.

-profile
    Profile the runtime performance of the generated code

-profile=c
    Profile runtime allocations

-property
    Enforce property syntax

-quiet
    Suppress non-essential compiler messages

-release
    Compile release version

-run srcfile args...
    Compile, link, and run the program srcfile with the rest of the command line, args..., as the arguments to the program. No .o or executable file is left behind.

-shared
    Generate shared library (DLL)

-transition=id
    With language change identified by 'id'

-transition=?
    List all language changes

-unittest
    Compile in unittest code

-v  verbose

-vcolumns
    Print character (column) numbers in diagnostics

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

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

-vgc
    List all gc allocations including hidden ones

-vtls
    List all variables going into thread local storage

-version=level
    compile in version code >= level

-version=ident
    compile in version code identified by ident

-w  Warnings as errors (compilation will halt)

-wi Warnings as messages (compilation will continue)

-X  Generate JSON file.

-Xffilename
    Write JSON file to filename

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.

BUGS
-g is only implemented for line numbers, not local symbols, because I haven't figured out how to do it yet. gdb still works, though, at the global symbol level.

The code generator output has not been tuned yet, so it can be bloated.

Shared libraries cannot be generated.

The exception handling is not compatible with the way g++ does it. I don't know if this is an issue or not.

The compiler sometimes gets the line number wrong on an error.

AUTHOR
Copyright (c) 1999-2017 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)