Input and Output files#

For any given input file, the file name suffix determines what kind of compilation is done. The following kinds of input file names are supported:

file.d

D source files.

file.dd

Ddoc source files.

file.di

D interface files.

You can specify more than one input file on the gdc command line, each being compiled separately in the compilation process. If you specify a -o file option, all the input files are compiled together, producing a single output file, named file. This is allowed even when using -S or -c.

A D interface file contains only what an import of the module needs, rather than the whole implementation of that module. They can be created by gdc from a D source file by using the -H option. When the compiler resolves an import declaration, it searches for matching .di files first, then for .d.

A Ddoc source file contains code in the D macro processor language. It is primarily designed for use in producing user documentation from embedded comments, with a slight affinity towards HTML generation. If a .d source file starts with the string Ddoc then it is treated as general purpose documentation, not as a D source file.