Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.


Compiler implementation of the D programming language.
This module contains high-level interfaces for interacting with DMD as a library.

Source id.d

void addImport(const(char)[] path);
Add import path to the global.path.
const(char)[] path import to add
string findDMDConfig(const(char)[] dmdFilePath);
Searches for a dmd.conf.
const(char)[] dmdFilePath path to the current DMD executable
full path to the found dmd.conf, null otherwise.
string findLDCConfig(const(char)[] ldcFilePath);
Searches for a ldc2.conf.
const(char)[] ldcFilePath path to the current LDC executable
full path to the found ldc2.conf, null otherwise.
string determineDefaultCompiler();
Detect the currently active compiler.
full path to the executable of the found compiler, null otherwise.
auto parseImportPathsFromConfig(const(char)[] iniFile, const(char)[] execDir);
Parses a dmd.conf or ldc2.conf config file and returns defined import paths.
const(char)[] iniFile iniFile to parse imports from
const(char)[] execDir directory of the compiler binary
forward range of import paths found in iniFile
auto findImportPaths();
Finds a dmd.conf and parses it for import paths. This depends on the $DMD environment variable. If $DMD is set to ldmd, it will try to detect and parse a ldc2.conf instead.
A forward range of normalized import paths.
Module parseModule(const(char)[] fileName, const(char)[] code = null);
Parse a module from a string.
const(char)[] fileName file to parse
const(char)[] code text to use instead of opening the file
the parsed module object
void fullSemantic(Module m);
Run full semantic analysis on a module.
string prettyPrint(Module m);
Pretty print a module.
Pretty printed module as string.