dlang CLI Reference
Reference for the dlang command-line tool: running scripts, type-checking, building native binaries, and using the REPL.
Core Commands
| Command | Description |
|---|---|
dlang run <file.dl> [-- args] | Compile and execute a Dlang source file, passing optional arguments to system.args(). |
dlang check <file.dl> | Parse, resolve imports, and validate static type annotations without running the program. |
dlang build <file.dl> -o <out> | Compile a standalone native executable. Refuses to overwrite an existing output file. |
dlang repl | Start an interactive Dlang session. |
dlang --version | Print the installed Dlang version. |
Passing Program Arguments
Use -- to forward command-line flags directly to your .dl program:
terminal
dlang run app.dl -- --port 8080 --host 127.0.0.1Read those arguments in Dlang with system.args():
args.dl
import system
for arg in system.args()
show arg
endEnvironment Variables
DLANG_HOME— Custom installation root directory (default:$HOME/.dlangon macOS/Linux,%USERPROFILE%\.dlangon Windows).DLANG_CLANG— Path to a specificclangexecutable used when linking native binaries.