DMD(1)

πŸ“¦ version 2.112.1, in alpine 3.24

πŸ’… DMD(1) β€” Digital Mars D2.x Compiler

okay bestie, gather round, because this is the manual page for dmd, the Digital Mars D2.x Compiler, and it's a whole moment. It lives over at The D Language Foundation, the manual name is dmd, and honestly it's giving "tiny file, enormous power." Let's get into it πŸ’–


✨ SYNOPSIS ✨

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

🌸 DESCRIPTION 🌸

dmd compiles source code written in the D programming language. that's it, that's the vibe. she takes your D code and turns it into something a computer can actually run. iconic behavior, no cap 🫢


πŸŽ€ OPTIONS πŸŽ€

this is the long part, so grab a snack. every single one of these is real, i promise πŸ‘‘

πŸ¦‹ Inputs (the things you feed her)

  • file, file.d, file.htm, file.html β€” D source files to compile. your actual code goes here.
  • 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 β€” and yes, it may contain # single-line comments. cute, right?

🌈 The full flag lineup (in order, bestie, i'm not skipping any)

  • -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.
  • -check=[h|help|?] β€” list information on all available checks.
  • -checkaction=[D|C|halt|context] β€” behavior on assert/boundscheck/finalswitch failure.
  • -checkaction=[h|help|?] β€” list information on all available check actions.
  • -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=ctfe β€” include code executed during CTFE in coverage report.
  • -cov=nnn β€” require at least nnn% code coverage.
  • -cpp=filename β€” use filename as the name of the C preprocessor to use for ImportC files.
  • -D β€” generate documentation.
  • -Dddirectory β€” write documentation file to directory.
  • -Dffilename β€” write documentation file to filename.
  • -d β€” silently allow deprecated features and symbols.
  • -de β€” issue an error when deprecated features or symbols are used (halt compilation).
  • -dw β€” issue a message when deprecated features or symbols are used (default).
  • -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).
  • -dllimport=value β€” Windows only: select symbols to dllimport (none/defaultLibsOnly/externalOnly/all).
  • -edition[=NNNNG[<filename>]] β€” set language edition to edition year, apply to <filename>.
  • -extern-std=standard β€” set C++ name mangling compatibility with standard.
  • -extern-std=[h|help|?] β€” list all supported standards.
  • -fIBT β€” generate Indirect Branch Tracking code.
  • -fPIC β€” generate position independent code.
  • -fPIE β€” generate position independent executables.
  • -ftime-trace β€” turn on compile time profiler, generate JSON file with results.
  • -ftime-trace-granularity= β€” minimum time granularity (in microseconds) traced by time profiler (default: 500).
  • -ftime-trace-file=filename β€” specify output file for -ftime-trace.
  • -g β€” add symbolic debug info.
  • -gdwarf=version β€” add DWARF 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.
  • -HC[=[?|h|help|silent|verbose]] β€” write C++ 'header' equivalent to stdout.
  • -HCd=directory β€” write C++ 'header' file to directory.
  • -HCf=filename β€” write C++ 'header' file to filename instead of stdout.
  • --help β€” print help and exit.
  • -I=directory β€” look for imports also in directory.
  • -extI=directory β€” look for imports that are out of the currently compiling binary, used to set the module as DllImport.
  • -i[=pattern] β€” include imported modules in the compilation.
  • -identifiers=table β€” specify the non-ASCII tables for D identifiers.
  • -identifiers-importc=table β€” specify the non-ASCII tables for ImportC identifiers.
  • -ignore β€” deprecated flag, unsupported pragmas are always ignored now. she's retired, let her rest πŸ’€
  • -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.
  • -lowmem β€” enable garbage collection for the compiler.
  • -m32 β€” generate 32 bit code.
  • -m64 β€” generate 64 bit code.
  • -main β€” add default main() if not present already (e.g. for unittesting).
  • -makedeps[=filename] β€” print dependencies in Makefile compatible format to filename or stdout.
  • -man β€” open web browser on manual page.
  • -map β€” generate linker .map file.
  • -mcpu=id β€” generate instructions for architecture identified by id.
  • -mcpu=[h|help|?] β€” 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).
  • -nothrow β€” assume no Exceptions will be thrown.
  • -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.
  • -oq β€” write object files with fully qualified file names.
  • -os=os β€” sets target operating system to os.
  • -P=preprocessorflag β€” pass preprocessorflag to C preprocessor.
  • -preview=name β€” enable an upcoming language change identified by name.
  • -preview=[h|help|?] β€” list all upcoming language changes.
  • -profile β€” profile runtime performance of generated code.
  • -profile=gc β€” profile runtime allocations.
  • -release β€” contracts and asserts are not emitted, and bounds checking is performed only in @safe functions.
  • -revert=name β€” revert language change identified by name.
  • -revert=[h|help|?] β€” list all revertable language changes.
  • -run β€” compile, link, and run the program srcfile.
  • -shared β€” generate shared library (DLL).
  • -target=triple β€” use triple as <arch>-[<vendor>-]<os>[-<cenv>[-<cppenv]].
  • -transition=name β€” help with language change identified by name.
  • -transition=[h|help|?] β€” list all language changes.
  • -unittest β€” compile in unit tests.
  • -v β€” verbose.
  • -vasm β€” list generated assembler for each function.
  • -vcolumns β€” print character (column) numbers in diagnostics.
  • -verror-style=[digitalmars|gnu|sarif] β€” set the style for file/line number annotations on compiler messages.
  • -verror-supplements=num β€” limit the number of supplemental messages for each error (0 means unlimited).
  • -verrors=num β€” limit the number of error/deprecation messages (0 means unlimited).
  • -verrors=[context|simple] β€” set the verbosity of error messages.
  • -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.
  • -visibility=value β€” default visibility of symbols (default/hidden/public).
  • -vtls β€” list all variables going into thread local storage.
  • -vtemplates=[list-instances] β€” list statistics on template instantiations.
  • -w β€” warnings as errors (compilation will halt).
  • -wi β€” warnings as messages (compilation will continue).
  • -wo β€” warnings about use of obsolete features (compilation will continue).
  • -X β€” generate JSON file.
  • -Xf=filename β€” write JSON file to filename.
  • -Xcc=driverflag β€” pass driverflag to linker driver (cc).

🧚 TRANSITIONS 🧚

these are the language changes you can pull up with -transition=id, and each one is a little side quest of its own:

  • field β€” list all non-mutable fields which occupy an object instance.
  • complex β€” give deprecation messages about all usages of complex or imaginary types.
  • tls β€” list all variables going into thread local storage.
  • in β€” list all usages of 'in' on parameter.

πŸ”₯ LINKING πŸ”₯

linking is done directly by the dmd compiler after a successful compile. if you do not want dmd running the linker, use the -c switch. simple as that 🫢

the actual linking is done by running gcc. why? because it ensures compatibility with modules compiled with gcc. teamwork makes the dream work, periodt.


🌟 FILES 🌟

  • /etc/dmd.conf β€” system wide dmd config file. see dmd.conf(5) for details.

πŸ’œ 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-2026 by The D Language Foundation written by Walter Bright. literal legend behavior, we stan πŸ’…


⭐ ONLINE DOCUMENTATION ⭐

https://dlang.org/dmd.html


🌈 SEE ALSO 🌈

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


ok that's the whole page bestie, you're officially dmd-literate πŸŽ“βœ¨

πŸ’– that's a wrap! brought to you by The D Language Foundation, dated 2026-05-01 β€” go compile something iconic πŸ’–

πŸ“¦ where this page comes from