DMD(1)
π 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@safeonly, 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 atfilename.-covβ do code coverage analysis.-cov=ctfeβ include code executed during CTFE in coverage report.-cov=nnnβ require at leastnnn%code coverage.-cpp=filenameβ usefilenameas the name of the C preprocessor to use for ImportC files.-Dβ generate documentation.-Dddirectoryβ write documentation file todirectory.-Dffilenameβ write documentation file tofilename.-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 byident.-debuglib=nameβ set symbolic debug library toname.-defaultlib=nameβ set default library toname.-depsβ print module dependencies (imports/file/version/debug/lib).-deps=filenameβ write module dependencies tofilename(only imports).-dllimport=valueβ Windows only: select symbols todllimport(none/defaultLibsOnly/externalOnly/all).-edition[=NNNNG[<filename>]]β set language edition to edition year, apply to<filename>.-extern-std=standardβ set C++ name mangling compatibility withstandard.-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 todirectory.-Hf=filenameβ write 'header' file tofilename.-HC[=[?|h|help|silent|verbose]]β write C++ 'header' equivalent to stdout.-HCd=directoryβ write C++ 'header' file todirectory.-HCf=filenameβ write C++ 'header' file tofilenameinstead of stdout.--helpβ print help and exit.-I=directoryβ look for imports also indirectory.-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 indirectory.-L=linkerflagβ passlinkerflagto 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 defaultmain()if not present already (e.g. for unittesting).-makedeps[=filename]β print dependencies in Makefile compatible format tofilenameor stdout.-manβ open web browser on manual page.-mapβ generate linker.mapfile.-mcpu=idβ generate instructions for architecture identified byid.-mcpu=[h|help|?]β list all architecture options.-mixin=filenameβ expand and save mixins to file specified byfilename.-mv=package.module=<filespec>β use<filespec>as source file forpackage.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 todirectory.-of=filenameβ name output file tofilename.-opβ preserve source path for output files.-oqβ write object files with fully qualified file names.-os=osβ sets target operating system toos.-P=preprocessorflagβ passpreprocessorflagto C preprocessor.-preview=nameβ enable an upcoming language change identified byname.-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@safefunctions.-revert=nameβ revert language change identified byname.-revert=[h|help|?]β list all revertable language changes.-runβ compile, link, and run the programsrcfile.-sharedβ generate shared library (DLL).-target=tripleβ usetripleas<arch>-[<vendor>-]<os>[-<cenv>[-<cppenv]].-transition=nameβ help with language change identified byname.-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 (0means unlimited).-verrors=numβ limit the number of error/deprecation messages (0means 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 byident.-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 tofilename.-Xcc=driverflagβ passdriverflagto 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 widedmdconfig file. seedmd.conf(5)for details.
π ENVIRONMENT π
the D compiler dmd uses the following environment variables:
DFLAGSβ the value ofDFLAGSis treated as if it were appended on the command line todmd.
π AUTHOR π
Copyright (c) 1999-2026 by The D Language Foundation written by Walter Bright. literal legend behavior, we stan π
β ONLINE DOCUMENTATION β
π 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
- alpine 3.24: dmd-doc 2.112.1-r2 Β· BSL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms