How to build program with DWT2 and DMD2?

Jacob Carlborg doob at
Fri Aug 2 04:28:08 PDT 2013

On 2013-07-31 15:47, JohnnyK wrote:
> Hi all,
>    Sorry for what may seem like a simple and obvious question to most
> DWT users.  First I would like to say that I have absolutely no
> experience with SWT in any form.  Second I know nothing of Eclipse other
> than that is what happens when the moon is directly between the earth
> and the sun.  I would like to know in a few simple steps or examples how
> to build a hello world or some other trivial GUI application with DWT.
> Following the instructions I was able to build the Snippets but that
> does not really tell you how to start a DWT project from scratch.  I
> would really like to get some steps on how to start a DWT project from a
> project folder somewhere and compile it.  So far the snippets show off
> the abilities of the library but they are not a tutorial and don't help
> us noobs.  The snippets would be good if they had HOW to comments or
> other documentation that explains how to get this done.  Also it would
> be nice if someone could share a typical directory layout of their DWT
> programming environment and what tools(aka IDE) they use.  I am finding
> this whole DWT thing to be a really daunting task without some kind of
> tutoring.  I have found DWT to be really hard to get started with.  I do
> like the fact that one can make a single executable that can be copied
> and executed without the need to install a huge API or additional
> baggage files before the executable will run.

Hello World using DWT would look something like this:

module main;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

void main ()
     auto display = new Display;
     auto shell = new Shell;;

     while (!shell.isDisposed)
         if (!display.readAndDispatch())


I would recommend compiling it with rdmd (supplied with dmd) :

rdmd main.d -I/path/to/dwt

For learning how to use DWT I would recommend all the tutorials out 
there for SWT. They are similar enough making it easy to port for SWT 
(Java) code to DWT (D).

/Jacob Carlborg

More information about the Digitalmars-d-dwt mailing list