Good day, fellow D developers.<div>After spending much time figuring out how to make DMD work fluently under 64-bit Windows 7 I've realized that this is not a trivial task and lots of people might have trouble with this, so I've decided to post my solution, that might save people a lot of time.</div>
<div>As we know, there are compatibility problems with 32-bit DMD binaries, because they are compiled using DMC back-end, which can only produce OMF binaries, so in order to avoid problems with linking against externally compiled libraries, it's much easier to stick to 64-bit binaries, so that DMD will use the Visual Studio linker to produce compatible COFF binaries. Another problem is that 32-bit DMD binaries are linked against obsolete 32-bit WinAPI libraries, which lack some very important functions, while the 64-bit binaries are required to link with the 64-bit libraries, supplied by the the Windows SDK.</div>
<div><br></div><div>And here's how this could be arranged:</div><div><br></div><div><div>1. Prepare your development folder.</div><div><span class="" style="white-space:pre">    </span>1.1. Create a folder with no spaces in its full path.</div>
<div><span class="" style="white-space:pre">    </span>1.2. Store its full path in the '%DEV_DIR_ROOT%' environment variable.</div><div>2. Get the Windows SDK.</div><div><span class="" style="white-space:pre">       </span>2.1. Download the Windows SDK.</div>
<div><span class="" style="white-space:pre">            </span>2.1.1. Navigate to '<a href="http://msdn.microsoft.com/en-US/windows//bb980924.aspx">http://msdn.microsoft.com/en-US/windows//bb980924.aspx</a>' in a web browser.</div>
<div><span class="" style="white-space:pre">            </span>2.1.2. Under section 2 (number '2' in a green circle) click on the bold blue 'Install Now' link.</div><div><span class="" style="white-space:pre">           </span>2.1.3. In the opened window click in the blue 'Download' button at the bottom of the page.</div>
<div><span class="" style="white-space:pre">            </span>2.1.4. Make sure, that the Windows SDK installer ('winsdk_web.exe') is downloaded.</div><div><span class="" style="white-space:pre"> </span>2.2. Install the downloaded Windows SDK.</div>
<div><span class="" style="white-space:pre">            </span>2.2.1. Navigate to the folder, where the Windows SDK installer was downloaded in a file browser.</div><div><span class="" style="white-space:pre">           </span>2.2.2. Double-click on the installer and agree to security warnings to launch it.</div>
<div><span class="" style="white-space:pre">            </span>2.2.3. Click next, read and agree to the license until you reach the 'Install Locations' screen.</div><div><span class="" style="white-space:pre">           </span>2.2.4. Store the path under 'Destination Folder for Tools' in the '%DEV_DIR_MSWINSDK%' (e.g. 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A') and click 'Next >'.</div>
<div><span class="" style="white-space:pre">            </span>2.3.3. On the 'Installation Options' uncheck everything except 'x64 Libraries' and 'Visual C++ Compilers' and click 'Next >'.</div><div>
<span class="" style="white-space:pre">               </span>2.3.4. Confirm that everything is correct and click 'Next >' to start installing.</div><div><span class="" style="white-space:pre">               </span>2.3.5. Make sure, tata the installation is completed succesfully.</div>
<div><span class="" style="white-space:pre">            </span>2.3.6. Store the path to the installed Visual Studio C++ compiler into the '%DEV_DIR_MSVC%' environment variable (e.g. 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC').</div>
<div>3. Get the DMD.</div><div><span class="" style="white-space:pre">      </span>3.1. Navigate to '<a href="http://ftp.digitalmars.com/dmd2beta.zip">http://ftp.digitalmars.com/dmd2beta.zip</a>' in a web browser.</div>
<div><span class="" style="white-space:pre">    </span>3.2. Make sure, that the DMD compiler archive ('dmd2beta.zip') is downloaded.</div><div><span class="" style="white-space:pre">      </span>3.3. Unzip the archive into '%DEV_DIR_ROOT%\Tools', so that the 'dmd2' folder in the archive will end up in '%DEV_DIR_ROOT%\Tools\dmd2'.</div>
<div><span class="" style="white-space:pre">    </span>3.4. Adapt the compiler configuration to the development environment.</div><div><span class="" style="white-space:pre">              </span>3.4.1. Open the file '%DEV_DIR_ROOT%\Tools\dmd2\windows\bin\sc.ini' in a text editor.</div>
<div><span class="" style="white-space:pre">            </span>3.4.2. Replace the line with 'LIB=' with the line 'LIB="%DEV_DIR_WINSDK%\Lib\x64";"%DEV_DIR_MSVC%\lib\amd64";"%@P%\..\lib"'.</div>
<div><span class="" style="white-space:pre">            </span>3.4.3. Add '-m64 -L/NOLOGO' to  the 'DFLAGS' variable.</div><div><span class="" style="white-space:pre">            </span>3.4.4. Remove the lines with 'VCINSTALLDIR=' and 'WindowsSdkDir='.</div>
<div><span class="" style="white-space:pre">            </span>3.4.5. Replace the like with 'LINKCMD64=' with the line 'LINKCMD64="%DEV_DIR_MSVC%\bin\amd64\link.exe"'</div><div><span class="" style="white-space:pre">          </span></div>
<div>Now "%DEV_DIR_ROOT%\Tools\dmd2\windows\bin\dmd.exe" will always use the Windows SDK libraries and Visual C++ compiler to produce 64-bit COFF binaries.</div><div><br></div><div>I hope I was helpful, because when I started to set up a development environment under 64-bit Windows 7, I went through a lot of problems to get here and I'd love to have this HOWTO at that time.</div>
<div><br></div>-- <br>Bye,<br>Gor Gyolchanyan.<br>
</div>