This page is intended as a guide to existing D samples and source code.
Official Examples
These are found in
\dmd\samples\d\ in the standard DMD installation.
 | Sample Name | Description | Things to find or learn | Compile hint |
hello | extended "Hello World" | command line arguments | |
d2html | d to html conversion with syntax highlighting | file io, string module | |
dclient.d dserver.d chello.d | COM example | creating a COM client/server in D | |
dhry | Dhrystone benchmark | standard benchmark | |
htmlget | sockets | uses std.socket, std.socketstream | dmd htmlget.d ws2_32.lib |
pi | pi calculation (1..4000 digits) | standard example | |
sieve | prime numbers | standard example | |
test | simpler form of winsamp | like winsamp | |
wc | char (word, line) count in file(s) | standard example | |
wc2 | extended wc, word statistics | using hash | |
winsamp | Windows program | rudimentary Windows program frame | dmd winsamp gdi32.lib winsamp.def |
|
|
The file all.sh gives help hints as how to compile the examples (such as which .lib files are needed).
See also: D Tutorial
FolderExamples