Re: DMD under 64-bit Windows 7 HOWTO

2013-08-18 Thread Yongwei Wu
I recently install DMD, and encountered this page while Googling. 
It gave me some hints, but my changes to make it work on 64-bit 
Windows 7 + MSVC 2012 is really much less drastic. After adding 
C:\dmd2\windows\bin to PATH, I only need to edit the LIB line in 
sc.ini to the following effect:


LIB=%VCINSTALLDIR%lib\amd64;%WindowsSdkDir%lib\win8\um\x64;%@P%\..\lib

I can then launch a VS2012 Developer Command Prompt to use either 
-m32 and -m64 modes. For the normal command prompt, -m32 works, 
but -m64 does not. I do not feel it a problem for me at all.


Re: DMD under 64-bit Windows 7 HOWTO

2013-06-29 Thread Jonathan Dunlap
Thanks! Adding those libs to the path worked. However, now I get 
the below error about a missing entry point.


LINK : fatal error LNK1561: entry point must be defined

--- errorlevel 1561

Exit code 1561

Build complete -- 1 error, 0 warnings



Re: DMD under 64-bit Windows 7 HOWTO

2013-06-29 Thread Jonathan Dunlap
Never mind, I fixed that linker error (had a minor issue with the 
main D entry point). I'm now building x64!


Re: DMD under 64-bit Windows 7 HOWTO

2013-06-28 Thread Jonathan Dunlap
I followed all the instructions to a tea, but I'm getting this 
one error when compiling:

==
Can't run 'C:\Program Files (x86)\Microsoft Visual Studio 
11.0\VC\bin\amd64\link.exe', check PATH


Exit code -1

Build complete -- 1 error, 0 warnings
==
The linked DOES exist in the below file and I can directly 
execute it from cmd:
C:\Program Files (x86)\Microsoft Visual Studio 
11.0\VC\bin\amd64\link.exe


My sc.ini:
[Version]
version=7.51 Build 020

[Environment]
LIB=%DEV_DIR_WINSDK%\Lib\x64;%DEV_DIR_MSVC%\lib\amd64;%@P%\..\lib
DFLAGS=-m64 -L/NOLOGO -I%@P%\..\..\src\phobos 
-I%@P%\..\..\src\druntime\import

LINKCMD=%@P%\link.exe
LINKCMD64=%DEV_DIR_MSVC%\bin\amd64\link.exe
==
Also, these directories also exist and have the proper libs:
%DEV_DIR_WINSDK%\Lib\x64;%DEV_DIR_MSVC%\lib\amd64

Help?


Re: DMD under 64-bit Windows 7 HOWTO

2013-06-28 Thread Michael

bat file that sets environment for D and related stuff.
-

@ECHO OFF

SET MS_VC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 
12.0\VC
SET MS_SDK_PATH=C:\Program Files (x86)\Microsoft 
SDKs\Windows\v7.1A


SET DE=%CD%\Environment

SET DEC=%DE%\Compiler
SET DER=%DE%\Runtime
SET DET=%DE%\Tool

SET DEC_D=%DEC%\Dmd
SET DEC_MINGW=%DEC%\MinGW

SET DE_PATH=%DET%;%DEC_D%\windows\bin;%DEC_MINGW%\bin
SET DE_LIB=%DEC_D%\windows\lib;%DEC_MINGW%\lib

SET DFLAGS=-I%DEC_D%\src\phobos -I%DEC_D%\src\druntime\import

SET PATH=%PATH%;%MS_VC_PATH%\bin;%DE_PATH%
SET LIB=%LIB%;%DE_LIB%

START D Environment cmd /E:ON /U /D
-

sc.ini
-
[Version]
version=7.51 Build 020

[Environment]
VCINSTALLDIR=%MS_VC_PATH%\
WindowsSdkDir=%MS_SDK_PATH%\
LINKCMD=%@P%\link.exe
LINKCMD64=%VCINSTALLDIR%\bin\x86_amd64\link.exe
-

In general check your paths to:
1. ..\bin\x86_amd64\link.exe
2. mspdb120.dll (it's for VS 2013, mspdb110.dll for VS 2012)
3. add path of mspdb*.dll to PATH variable



Re: DMD under 64-bit Windows 7 HOWTO

2013-06-04 Thread Sean Cavanaugh

On 6/1/2013 11:08 PM, Sean Cavanaugh wrote:

On 6/1/2013 11:06 PM, Sean Cavanaugh wrote:

On 6/1/2013 8:57 PM, Adam Wilson wrote:


Ok, so how did you get VisualD to not use OPTLINK?



I have my project settings set to 'Combined compile and link'
(bottom-most option of the General part of the project settings).

dmd is invoking the linker specified in the sc.ini this way

(its a small and monolithic executable)




The other configuration types there seemed to work for me as well, so
I'm having trouble even breaking it.


I remember having to add in -m64 to the command line int he settings 
somewhere as well, but this is from memory and I'm writing this from 
work from memory before I forget again :)





Re: DMD under 64-bit Windows 7 HOWTO

2013-06-03 Thread Rainer Schuetze



On 03.06.2013 01:38, Adam Wilson wrote:

On Sat, 01 Jun 2013 21:08:48 -0700, Sean Cavanaugh
worksonmymach...@gmail.com wrote:


On 6/1/2013 11:06 PM, Sean Cavanaugh wrote:

On 6/1/2013 8:57 PM, Adam Wilson wrote:


Ok, so how did you get VisualD to not use OPTLINK?



I have my project settings set to 'Combined compile and link'
(bottom-most option of the General part of the project settings).

dmd is invoking the linker specified in the sc.ini this way

(its a small and monolithic executable)




The other configuration types there seemed to work for me as well, so
I'm having trouble even breaking it.


And I can't seem to get it to work. I am now getting a stack overflow
from pipedmd trying to build an x64 DLL using VS2012.



pipedmd is a program to demangle symbols in linker output and to monitor 
file accesses for better library dependencies. It hasn't been tested too 
well with the microsoft linker (I guess it might have problem with 
64-bit executables), so you might try to disable it by switching off 
both demangle names in link errors and Monitor optlink dependencies 
in the global Visual D settings.


Re: DMD under 64-bit Windows 7 HOWTO

2013-06-03 Thread Adam Wilson
On Mon, 03 Jun 2013 14:36:45 -0700, Rainer Schuetze r.sagita...@gmx.de  
wrote:





On 03.06.2013 01:38, Adam Wilson wrote:

On Sat, 01 Jun 2013 21:08:48 -0700, Sean Cavanaugh
worksonmymach...@gmail.com wrote:


On 6/1/2013 11:06 PM, Sean Cavanaugh wrote:

On 6/1/2013 8:57 PM, Adam Wilson wrote:


Ok, so how did you get VisualD to not use OPTLINK?



I have my project settings set to 'Combined compile and link'
(bottom-most option of the General part of the project settings).

dmd is invoking the linker specified in the sc.ini this way

(its a small and monolithic executable)




The other configuration types there seemed to work for me as well, so
I'm having trouble even breaking it.


And I can't seem to get it to work. I am now getting a stack overflow
from pipedmd trying to build an x64 DLL using VS2012.



pipedmd is a program to demangle symbols in linker output and to monitor  
file accesses for better library dependencies. It hasn't been tested too  
well with the microsoft linker (I guess it might have problem with  
64-bit executables), so you might try to disable it by switching off  
both demangle names in link errors and Monitor optlink dependencies  
in the global Visual D settings.


Oops, I forgot to update this. It actually wasn't within pipedmd, I was  
able to pin it down to dmd itself. There are some REALLY strange  
interactions with -H and -D in DMD on Windows, if you only specify one of  
those two options DMD will act like no command line was received and  
display the command line switch listing, if you use both it will give you  
the stack overflow. This is appearing with the stock DLL template in  
Visual D. I haven't submitted a bug report because I am not even sure who  
is at fault, DMD I think, and even then I don't really know what's wrong.


--
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/


Re: DMD under 64-bit Windows 7 HOWTO

2013-06-02 Thread Michael


The last issue is the announcement that VS 2012 update 3 is the 
last one and developers will need to buy VS.Next for the 
remaining C++11 updates and the by side updates are actually 
not going to happen.


I think they will start a new release circle of product, but 
compiler tools will remain free as beer.


Re: DMD under 64-bit Windows 7 HOWTO

2013-06-02 Thread Adam Wilson
On Sat, 01 Jun 2013 21:06:04 -0700, Sean Cavanaugh  
worksonmymach...@gmail.com wrote:



On 6/1/2013 8:57 PM, Adam Wilson wrote:


Ok, so how did you get VisualD to not use OPTLINK?



I have my project settings set to 'Combined compile and link'  
(bottom-most option of the General part of the project settings).


dmd is invoking the linker specified in the sc.ini this way

(its a small and monolithic executable)




Weird, I have the same option set and it's still trying to invoke OPTLINK.  
OPTLINK is erroring out on the x64 COFF files so I know it's not DMD...


--
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/


Re: DMD under 64-bit Windows 7 HOWTO

2013-06-02 Thread Adam Wilson
On Sat, 01 Jun 2013 21:08:48 -0700, Sean Cavanaugh  
worksonmymach...@gmail.com wrote:



On 6/1/2013 11:06 PM, Sean Cavanaugh wrote:

On 6/1/2013 8:57 PM, Adam Wilson wrote:


Ok, so how did you get VisualD to not use OPTLINK?



I have my project settings set to 'Combined compile and link'
(bottom-most option of the General part of the project settings).

dmd is invoking the linker specified in the sc.ini this way

(its a small and monolithic executable)




The other configuration types there seemed to work for me as well, so  
I'm having trouble even breaking it.


And I can't seem to get it to work. I am now getting a stack overflow from  
pipedmd trying to build an x64 DLL using VS2012.


--
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/


Re: DMD under 64-bit Windows 7 HOWTO

2013-06-01 Thread Joakim

On Sunday, 26 May 2013 at 01:24:51 UTC, Manu wrote:
I  might just add, that if you have Visual Studio installed 
(which I
presume many Windows dev's do), then you don't need to do 
ANYTHING.

DMD64 just works if VS is present.

I didn't do a single thing to get DMD-Win64 working. And it's 
working great.
I just set up an environment on Win 7 x64 using the Windows SDK 
version 7.1 without Visual Studio.  Using the DOS prompt that 
comes with the Windows SDK, which initializes various build 
variables, to compile to 64-bit COFF with dmd and link to a 
COFF64 C static library, the only thing I had to do was set a 
VCINSTALLDIR environment variable (set VCINSTALLDIR=C:\Program 
Files (x86)\Microsoft Visual Studio 10.0\VC\), so that dmd could 
find the 64-bit linker, link.exe.


Other than that, all you need to do is install the Windows SDK 
7.1, which comes with the compiler, linker, and various build 
tools.  I had read that the latest Windows SDK, 8.0, does not 
come with the compiler and other build tools, though perhaps that 
has changed since, I haven't checked recently.



You should make sure this is clear at the top of any wiki entry.

Perhaps a future push to convince Walter to port DMD-Win32 to 
COFF/WinSDK

aswell might be nice ;)
Win32 is still an important platform for many (most?) users.
I agree.  I wonder how much more work COFF32 would be, ie why it 
wasn't done in the first place.  I was surprised when I started 
using D on Windows how painful the OMF/COFF situation was, 
especially since Windows support has long been pointed at as a 
strength for D.


Great work to make it this easy on Win64, :) COFF32 would push D 
the rest of the way.


Re: DMD under 64-bit Windows 7 HOWTO

2013-06-01 Thread Sean Cavanaugh

On 5/25/2013 8:24 PM, Manu wrote:

I  might just add, that if you have Visual Studio installed (which I
presume many Windows dev's do), then you don't need to do ANYTHING.
DMD64 just works if VS is present.

I didn't do a single thing to get DMD-Win64 working. And it's working great.

You should make sure this is clear at the top of any wiki entry.

Perhaps a future push to convince Walter to port DMD-Win32 to
COFF/WinSDK aswell might be nice ;)
Win32 is still an important platform for many (most?) users.




under VS2012 I had to edit sc.ini to point directly to the linker:

LINKCMD64=C:\Program Files (x86)\Microsoft Visual Studio 
11.0\VC\bin\amd64\link.exe


and in visuald add the win8 sdk lib path to the lib directories:

C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x64

And from there it just worked

The other variables the stock sc.ini uses are only set if you run 
vsvars32.bat (and the newer batch files only enable 1 platform at a time 
instead of all of them which can trip people up trying to do everything 
from a single command line)





Re: DMD under 64-bit Windows 7 HOWTO

2013-06-01 Thread Adam Wilson
On Sat, 01 Jun 2013 17:50:46 -0700, Sean Cavanaugh  
worksonmymach...@gmail.com wrote:



On 5/25/2013 8:24 PM, Manu wrote:

I  might just add, that if you have Visual Studio installed (which I
presume many Windows dev's do), then you don't need to do ANYTHING.
DMD64 just works if VS is present.

I didn't do a single thing to get DMD-Win64 working. And it's working  
great.


You should make sure this is clear at the top of any wiki entry.

Perhaps a future push to convince Walter to port DMD-Win32 to
COFF/WinSDK aswell might be nice ;)
Win32 is still an important platform for many (most?) users.




under VS2012 I had to edit sc.ini to point directly to the linker:

LINKCMD64=C:\Program Files (x86)\Microsoft Visual Studio  
11.0\VC\bin\amd64\link.exe


and in visuald add the win8 sdk lib path to the lib directories:

C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x64

And from there it just worked

The other variables the stock sc.ini uses are only set if you run  
vsvars32.bat (and the newer batch files only enable 1 platform at a time  
instead of all of them which can trip people up trying to do everything  
from a single command line)




Ok, so how did you get VisualD to not use OPTLINK?

--
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/


Re: DMD under 64-bit Windows 7 HOWTO

2013-06-01 Thread Sean Cavanaugh

On 6/1/2013 11:06 PM, Sean Cavanaugh wrote:

On 6/1/2013 8:57 PM, Adam Wilson wrote:


Ok, so how did you get VisualD to not use OPTLINK?



I have my project settings set to 'Combined compile and link'
(bottom-most option of the General part of the project settings).

dmd is invoking the linker specified in the sc.ini this way

(its a small and monolithic executable)




The other configuration types there seemed to work for me as well, so 
I'm having trouble even breaking it.


Re: DMD under 64-bit Windows 7 HOWTO

2013-06-01 Thread Sean Cavanaugh

On 6/1/2013 8:57 PM, Adam Wilson wrote:


Ok, so how did you get VisualD to not use OPTLINK?



I have my project settings set to 'Combined compile and link' 
(bottom-most option of the General part of the project settings).


dmd is invoking the linker specified in the sc.ini this way

(its a small and monolithic executable)




Re: DMD under 64-bit Windows 7 HOWTO

2013-05-27 Thread Paulo Pinto

On Sunday, 26 May 2013 at 23:33:56 UTC, Adam Wilson wrote:
On Sun, 26 May 2013 16:22:54 -0700, Manu turkey...@gmail.com 
wrote:



On 26 May 2013 15:03, Adam Wilson flybo...@gmail.com wrote:

On Sat, 25 May 2013 18:24:41 -0700, Manu 
turkey...@gmail.com wrote:


FYI. DMD did not work out-of-the-box on a vanilla VS2012/Win8 
install. The
Windows 8 SDK no longer includes the C++ compilers and VS2012 
doesn't setup

the Environment Variables used in sc.ini.



Ah wow, sorry! I had no idea!
I tent to lag 2-3 revisions behind the head of VS (finally 
using 2010) ;)

They seem to make every version worse!



Indeed. Some days I wonder if they actually care anymore.



Well they really try hard to piss off developers.

The last issue is the announcement that VS 2012 update 3 is the 
last one and developers will need to buy VS.Next for the 
remaining C++11 updates and the by side updates are actually not 
going to happen.


http://blogs.msdn.com/b/bharry/archive/2013/05/08/some-thoughts-on-a-comment-about-vs-2012-3.aspx



Re: DMD under 64-bit Windows 7 HOWTO

2013-05-26 Thread Walter Bright

On 5/25/2013 10:03 PM, Adam Wilson wrote:

On Sat, 25 May 2013 18:24:41 -0700, Manu turkey...@gmail.com wrote:

FYI. DMD did not work out-of-the-box on a vanilla VS2012/Win8 install. The
Windows 8 SDK no longer includes the C++ compilers and VS2012 doesn't setup the
Environment Variables used in sc.ini.

But the most annoying part is that using the Win8 SDK causes the linker to spit
out dozens of external symbol resolution failures. It was at this point that I
gave up.


Microsoft linker changing constantly and breaking things was why Zortech decided 
to do their own linker back in the 80's.



BTW, nothing will get fixed if you don't file bugzilla reports!



Re: DMD under 64-bit Windows 7 HOWTO

2013-05-26 Thread Paulo Pinto

Am 26.05.2013 07:03, schrieb Adam Wilson:

On Sat, 25 May 2013 18:24:41 -0700, Manu turkey...@gmail.com wrote:

FYI. DMD did not work out-of-the-box on a vanilla VS2012/Win8 install.
The Windows 8 SDK no longer includes the C++ compilers and VS2012
doesn't setup the Environment Variables used in sc.ini.



You can get them via the Desktop Express version, the one they added 
back after peer pressure.




Re: DMD under 64-bit Windows 7 HOWTO

2013-05-26 Thread Manu
On 26 May 2013 15:03, Adam Wilson flybo...@gmail.com wrote:

 On Sat, 25 May 2013 18:24:41 -0700, Manu turkey...@gmail.com wrote:

 FYI. DMD did not work out-of-the-box on a vanilla VS2012/Win8 install. The
 Windows 8 SDK no longer includes the C++ compilers and VS2012 doesn't setup
 the Environment Variables used in sc.ini.


Ah wow, sorry! I had no idea!
I tent to lag 2-3 revisions behind the head of VS (finally using 2010) ;)
They seem to make every version worse!

But the most annoying part is that using the Win8 SDK causes the linker to
 spit out dozens of external symbol resolution failures. It was at this
 point that I gave up.

  I  might just add, that if you have Visual Studio installed (which I
 presume many Windows dev's do), then you don't need to do ANYTHING.
 DMD64 just works if VS is present.

 I didn't do a single thing to get DMD-Win64 working. And it's working
 great.

 You should make sure this is clear at the top of any wiki entry.

 Perhaps a future push to convince Walter to port DMD-Win32 to COFF/WinSDK
 aswell might be nice ;)
 Win32 is still an important platform for many (most?) users.


 On 18 December 2012 23:32, Gor Gyolchanyan gor.f.gyolchan...@gmail.com*
 *wrote:

  Good day, fellow D developers.
 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.
 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.

 And here's how this could be arranged:

 1. Prepare your development folder.
 1.1. Create a folder with no spaces in its full path.
  1.2. Store its full path in the '%DEV_DIR_ROOT%' environment variable.
 2. Get the Windows SDK.
 2.1. Download the Windows SDK.
  2.1.1. Navigate to '
 http://msdn.microsoft.com/en-**US/windows//bb980924.aspxhttp://msdn.microsoft.com/en-US/windows//bb980924.aspx'
 in a web browser.
  2.1.2. Under section 2 (number '2' in a green circle) click on the bold
 blue 'Install Now' link.
 2.1.3. In the opened window click in the blue 'Download' button at the
 bottom of the page.
  2.1.4. Make sure, that the Windows SDK installer ('winsdk_web.exe') is
 downloaded.
 2.2. Install the downloaded Windows SDK.
  2.2.1. Navigate to the folder, where the Windows SDK installer was
 downloaded in a file browser.
 2.2.2. Double-click on the installer and agree to security warnings to
 launch it.
  2.2.3. Click next, read and agree to the license until you reach the
 'Install Locations' screen.
 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 '.
  2.3.3. On the 'Installation Options' uncheck everything except 'x64
 Libraries' and 'Visual C++ Compilers' and click 'Next '.
  2.3.4. Confirm that everything is correct and click 'Next ' to start
 installing.
 2.3.5. Make sure, tata the installation is completed succesfully.
  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').
 3. Get the DMD.
 3.1. Navigate to 
 'http://ftp.digitalmars.com/**dmd2beta.ziphttp://ftp.digitalmars.com/dmd2beta.zip'
 in a web
 browser.
  3.2. Make sure, that the DMD compiler archive ('dmd2beta.zip') is
 downloaded.
 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'.
  3.4. Adapt the compiler configuration to the development environment.
 3.4.1. Open the file '%DEV_DIR_ROOT%\Tools\dmd2\**windows\bin\sc.ini'
 in a
 text editor.
  3.4.2. Replace the line with 'LIB=' with the line
 'LIB=%DEV_DIR_WINSDK%\Lib\**x64;%DEV_DIR_MSVC%\lib\**
 amd64;%@P%\..\lib'.
  3.4.3. Add '-m64 -L/NOLOGO' to  the 'DFLAGS' variable.
 3.4.4. Remove the lines with 'VCINSTALLDIR=' and 'WindowsSdkDir='.
  3.4.5. Replace the like with 'LINKCMD64=' with the line
 'LINKCMD64=%DEV_DIR_MSVC%\**bin\amd64\link.exe'
  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.

 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 

Re: DMD under 64-bit Windows 7 HOWTO

2013-05-26 Thread Adam Wilson
On Sun, 26 May 2013 00:41:46 -0700, Walter Bright  
newshou...@digitalmars.com wrote:



On 5/25/2013 10:03 PM, Adam Wilson wrote:

On Sat, 25 May 2013 18:24:41 -0700, Manu turkey...@gmail.com wrote:

FYI. DMD did not work out-of-the-box on a vanilla VS2012/Win8 install.  
The
Windows 8 SDK no longer includes the C++ compilers and VS2012 doesn't  
setup the

Environment Variables used in sc.ini.

But the most annoying part is that using the Win8 SDK causes the linker  
to spit
out dozens of external symbol resolution failures. It was at this point  
that I

gave up.


Microsoft linker changing constantly and breaking things was why Zortech  
decided to do their own linker back in the 80's.



BTW, nothing will get fixed if you don't file bugzilla reports!



Well, I wasn't sure if it was the linker or the libraries, because I also  
go some weird corrupt file errors with shell32 for example...


--
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/


Re: DMD under 64-bit Windows 7 HOWTO

2013-05-26 Thread Adam Wilson
On Sun, 26 May 2013 07:12:32 -0700, Paulo Pinto pj...@progtools.org  
wrote:



Am 26.05.2013 07:03, schrieb Adam Wilson:

On Sat, 25 May 2013 18:24:41 -0700, Manu turkey...@gmail.com wrote:

FYI. DMD did not work out-of-the-box on a vanilla VS2012/Win8 install.
The Windows 8 SDK no longer includes the C++ compilers and VS2012
doesn't setup the Environment Variables used in sc.ini.



You can get them via the Desktop Express version, the one they added  
back after peer pressure.




Indeed. I have VS2012 Premium, but it does mean that you have to repath  
your environment variables to the Visual Studio folders instead of the  
Windows SDK folders and that you need to have VS installed.


--
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/


Re: DMD under 64-bit Windows 7 HOWTO

2013-05-26 Thread Adam Wilson

On Sun, 26 May 2013 16:22:54 -0700, Manu turkey...@gmail.com wrote:


On 26 May 2013 15:03, Adam Wilson flybo...@gmail.com wrote:


On Sat, 25 May 2013 18:24:41 -0700, Manu turkey...@gmail.com wrote:

FYI. DMD did not work out-of-the-box on a vanilla VS2012/Win8 install.  
The
Windows 8 SDK no longer includes the C++ compilers and VS2012 doesn't  
setup

the Environment Variables used in sc.ini.



Ah wow, sorry! I had no idea!
I tent to lag 2-3 revisions behind the head of VS (finally using 2010) ;)
They seem to make every version worse!



Indeed. Some days I wonder if they actually care anymore.

But the most annoying part is that using the Win8 SDK causes the linker  
to

spit out dozens of external symbol resolution failures. It was at this
point that I gave up.

 I  might just add, that if you have Visual Studio installed (which I

presume many Windows dev's do), then you don't need to do ANYTHING.
DMD64 just works if VS is present.

I didn't do a single thing to get DMD-Win64 working. And it's working
great.

You should make sure this is clear at the top of any wiki entry.

Perhaps a future push to convince Walter to port DMD-Win32 to  
COFF/WinSDK

aswell might be nice ;)
Win32 is still an important platform for many (most?) users.


On 18 December 2012 23:32, Gor Gyolchanyan  
gor.f.gyolchan...@gmail.com*

*wrote:

 Good day, fellow D developers.
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.
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.

And here's how this could be arranged:

1. Prepare your development folder.
1.1. Create a folder with no spaces in its full path.
 1.2. Store its full path in the '%DEV_DIR_ROOT%' environment  
variable.

2. Get the Windows SDK.
2.1. Download the Windows SDK.
 2.1.1. Navigate to '
http://msdn.microsoft.com/en-**US/windows//bb980924.aspxhttp://msdn.microsoft.com/en-US/windows//bb980924.aspx'
in a web browser.
 2.1.2. Under section 2 (number '2' in a green circle) click on the  
bold

blue 'Install Now' link.
2.1.3. In the opened window click in the blue 'Download' button at the
bottom of the page.
 2.1.4. Make sure, that the Windows SDK installer ('winsdk_web.exe')  
is

downloaded.
2.2. Install the downloaded Windows SDK.
 2.2.1. Navigate to the folder, where the Windows SDK installer was
downloaded in a file browser.
2.2.2. Double-click on the installer and agree to security warnings to
launch it.
 2.2.3. Click next, read and agree to the license until you reach the
'Install Locations' screen.
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 '.
 2.3.3. On the 'Installation Options' uncheck everything except 'x64
Libraries' and 'Visual C++ Compilers' and click 'Next '.
 2.3.4. Confirm that everything is correct and click 'Next ' to start
installing.
2.3.5. Make sure, tata the installation is completed succesfully.
 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').
3. Get the DMD.
3.1. Navigate to  
'http://ftp.digitalmars.com/**dmd2beta.ziphttp://ftp.digitalmars.com/dmd2beta.zip'

in a web
browser.
 3.2. Make sure, that the DMD compiler archive ('dmd2beta.zip') is
downloaded.
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'.
 3.4. Adapt the compiler configuration to the development environment.
3.4.1. Open the file '%DEV_DIR_ROOT%\Tools\dmd2\**windows\bin\sc.ini'
in a
text editor.
 3.4.2. Replace the line with 'LIB=' with the line
'LIB=%DEV_DIR_WINSDK%\Lib\**x64;%DEV_DIR_MSVC%\lib\**
amd64;%@P%\..\lib'.
 3.4.3. Add '-m64 -L/NOLOGO' to  the 'DFLAGS' variable.
3.4.4. Remove the lines with 'VCINSTALLDIR=' and 'WindowsSdkDir='.
 3.4.5. Replace the like with 'LINKCMD64=' with the line
'LINKCMD64=%DEV_DIR_MSVC%\**bin\amd64\link.exe'
 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.

I hope I was helpful, because when I started to set up a development

Re: DMD under 64-bit Windows 7 HOWTO

2013-05-25 Thread Sébastien.Kunz-Jacques
On Tuesday, 18 December 2012 at 13:33:03 UTC, Gor Gyolchanyan 
wrote:

Good day, fellow D developers.
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.
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.

And here's how this could be arranged:

1. Prepare your development folder.
1.1. Create a folder with no spaces in its full path.
1.2. Store its full path in the '%DEV_DIR_ROOT%' environment 
variable.

2. Get the Windows SDK.
2.1. Download the Windows SDK.
2.1.1. Navigate to 
'http://msdn.microsoft.com/en-US/windows//bb980924.aspx'

in a web browser.
2.1.2. Under section 2 (number '2' in a green circle) click on 
the bold

blue 'Install Now' link.
2.1.3. In the opened window click in the blue 'Download' button 
at the

bottom of the page.
2.1.4. Make sure, that the Windows SDK installer 
('winsdk_web.exe') is

downloaded.
2.2. Install the downloaded Windows SDK.
2.2.1. Navigate to the folder, where the Windows SDK installer 
was

downloaded in a file browser.
2.2.2. Double-click on the installer and agree to security 
warnings to

launch it.
2.2.3. Click next, read and agree to the license until you 
reach the

'Install Locations' screen.
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 '.
2.3.3. On the 'Installation Options' uncheck everything except 
'x64

Libraries' and 'Visual C++ Compilers' and click 'Next '.
2.3.4. Confirm that everything is correct and click 'Next ' to 
start

installing.
2.3.5. Make sure, tata the installation is completed 
succesfully.
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').
3. Get the DMD.
3.1. Navigate to 'http://ftp.digitalmars.com/dmd2beta.zip' in a 
web browser.
3.2. Make sure, that the DMD compiler archive ('dmd2beta.zip') 
is

downloaded.
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'.
3.4. Adapt the compiler configuration to the development 
environment.
3.4.1. Open the file 
'%DEV_DIR_ROOT%\Tools\dmd2\windows\bin\sc.ini' in a

text editor.
3.4.2. Replace the line with 'LIB=' with the line
'LIB=%DEV_DIR_WINSDK%\Lib\x64;%DEV_DIR_MSVC%\lib\amd64;%@P%\..\lib'.
3.4.3. Add '-m64 -L/NOLOGO' to  the 'DFLAGS' variable.
3.4.4. Remove the lines with 'VCINSTALLDIR=' and 
'WindowsSdkDir='.

3.4.5. Replace the like with 'LINKCMD64=' with the line
'LINKCMD64=%DEV_DIR_MSVC%\bin\amd64\link.exe'
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.

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.


I just tried this with the current beta (may 25, 2.063). It lacks 
the -m64 option. Was it present in some older beta ?




Re: DMD under 64-bit Windows 7 HOWTO

2013-05-25 Thread Rainer Schuetze



On 25.05.2013 15:03, Sébastien Kunz-Jacques kunzj...@yahoo.fr wrote:

On Tuesday, 18 December 2012 at 13:33:03 UTC, Gor Gyolchanyan wrote:


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.


I just tried this with the current beta (may 25, 2.063). It lacks the
-m64 option. Was it present in some older beta ?



-m64 isn't displayed in the usage screen (no idea why it is excluded 
there), but it is supported aswell as -m32 (the default).


Re: DMD under 64-bit Windows 7 HOWTO

2013-05-25 Thread Sébastien.Kunz-Jacques

On Saturday, 25 May 2013 at 13:24:56 UTC, Rainer Schuetze wrote:



On 25.05.2013 15:03, Sébastien Kunz-Jacques 
kunzj...@yahoo.fr wrote:
On Tuesday, 18 December 2012 at 13:33:03 UTC, Gor Gyolchanyan 
wrote:


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.


I just tried this with the current beta (may 25, 2.063). It 
lacks the

-m64 option. Was it present in some older beta ?



-m64 isn't displayed in the usage screen (no idea why it is 
excluded there), but it is supported aswell as -m32 (the 
default).


Thanks for the tip. I had incorrectly put quotes around -m64 
-L/NOLOGO and the resulting error message


unrecognized switch '-m64 -L/NOLOGO'

plus the lack of mention of -m64 in the dmd command-line help 
confused me.


Re: DMD under 64-bit Windows 7 HOWTO

2013-05-25 Thread Manu
I  might just add, that if you have Visual Studio installed (which I
presume many Windows dev's do), then you don't need to do ANYTHING.
DMD64 just works if VS is present.

I didn't do a single thing to get DMD-Win64 working. And it's working great.

You should make sure this is clear at the top of any wiki entry.

Perhaps a future push to convince Walter to port DMD-Win32 to COFF/WinSDK
aswell might be nice ;)
Win32 is still an important platform for many (most?) users.


On 18 December 2012 23:32, Gor Gyolchanyan gor.f.gyolchan...@gmail.comwrote:

 Good day, fellow D developers.
 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.
 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.

 And here's how this could be arranged:

 1. Prepare your development folder.
 1.1. Create a folder with no spaces in its full path.
  1.2. Store its full path in the '%DEV_DIR_ROOT%' environment variable.
 2. Get the Windows SDK.
 2.1. Download the Windows SDK.
  2.1.1. Navigate to '
 http://msdn.microsoft.com/en-US/windows//bb980924.aspx' in a web browser.
  2.1.2. Under section 2 (number '2' in a green circle) click on the bold
 blue 'Install Now' link.
 2.1.3. In the opened window click in the blue 'Download' button at the
 bottom of the page.
  2.1.4. Make sure, that the Windows SDK installer ('winsdk_web.exe') is
 downloaded.
 2.2. Install the downloaded Windows SDK.
  2.2.1. Navigate to the folder, where the Windows SDK installer was
 downloaded in a file browser.
 2.2.2. Double-click on the installer and agree to security warnings to
 launch it.
  2.2.3. Click next, read and agree to the license until you reach the
 'Install Locations' screen.
 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 '.
  2.3.3. On the 'Installation Options' uncheck everything except 'x64
 Libraries' and 'Visual C++ Compilers' and click 'Next '.
  2.3.4. Confirm that everything is correct and click 'Next ' to start
 installing.
 2.3.5. Make sure, tata the installation is completed succesfully.
  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').
 3. Get the DMD.
 3.1. Navigate to 'http://ftp.digitalmars.com/dmd2beta.zip' in a web
 browser.
  3.2. Make sure, that the DMD compiler archive ('dmd2beta.zip') is
 downloaded.
 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'.
  3.4. Adapt the compiler configuration to the development environment.
 3.4.1. Open the file '%DEV_DIR_ROOT%\Tools\dmd2\windows\bin\sc.ini' in a
 text editor.
  3.4.2. Replace the line with 'LIB=' with the line
 'LIB=%DEV_DIR_WINSDK%\Lib\x64;%DEV_DIR_MSVC%\lib\amd64;%@P%\..\lib'.
  3.4.3. Add '-m64 -L/NOLOGO' to  the 'DFLAGS' variable.
 3.4.4. Remove the lines with 'VCINSTALLDIR=' and 'WindowsSdkDir='.
  3.4.5. Replace the like with 'LINKCMD64=' with the line
 'LINKCMD64=%DEV_DIR_MSVC%\bin\amd64\link.exe'
  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.

 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.

 --
 Bye,
 Gor Gyolchanyan.



Re: DMD under 64-bit Windows 7 HOWTO

2013-05-25 Thread Adam Wilson

On Sat, 25 May 2013 18:24:41 -0700, Manu turkey...@gmail.com wrote:

FYI. DMD did not work out-of-the-box on a vanilla VS2012/Win8 install. The  
Windows 8 SDK no longer includes the C++ compilers and VS2012 doesn't  
setup the Environment Variables used in sc.ini.


But the most annoying part is that using the Win8 SDK causes the linker to  
spit out dozens of external symbol resolution failures. It was at this  
point that I gave up.



I  might just add, that if you have Visual Studio installed (which I
presume many Windows dev's do), then you don't need to do ANYTHING.
DMD64 just works if VS is present.

I didn't do a single thing to get DMD-Win64 working. And it's working  
great.


You should make sure this is clear at the top of any wiki entry.

Perhaps a future push to convince Walter to port DMD-Win32 to COFF/WinSDK
aswell might be nice ;)
Win32 is still an important platform for many (most?) users.


On 18 December 2012 23:32, Gor Gyolchanyan  
gor.f.gyolchan...@gmail.comwrote:



Good day, fellow D developers.
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.
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.

And here's how this could be arranged:

1. Prepare your development folder.
1.1. Create a folder with no spaces in its full path.
 1.2. Store its full path in the '%DEV_DIR_ROOT%' environment variable.
2. Get the Windows SDK.
2.1. Download the Windows SDK.
 2.1.1. Navigate to '
http://msdn.microsoft.com/en-US/windows//bb980924.aspx' in a web  
browser.

 2.1.2. Under section 2 (number '2' in a green circle) click on the bold
blue 'Install Now' link.
2.1.3. In the opened window click in the blue 'Download' button at the
bottom of the page.
 2.1.4. Make sure, that the Windows SDK installer ('winsdk_web.exe') is
downloaded.
2.2. Install the downloaded Windows SDK.
 2.2.1. Navigate to the folder, where the Windows SDK installer was
downloaded in a file browser.
2.2.2. Double-click on the installer and agree to security warnings to
launch it.
 2.2.3. Click next, read and agree to the license until you reach the
'Install Locations' screen.
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 '.
 2.3.3. On the 'Installation Options' uncheck everything except 'x64
Libraries' and 'Visual C++ Compilers' and click 'Next '.
 2.3.4. Confirm that everything is correct and click 'Next ' to start
installing.
2.3.5. Make sure, tata the installation is completed succesfully.
 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').
3. Get the DMD.
3.1. Navigate to 'http://ftp.digitalmars.com/dmd2beta.zip' in a web
browser.
 3.2. Make sure, that the DMD compiler archive ('dmd2beta.zip') is
downloaded.
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'.
 3.4. Adapt the compiler configuration to the development environment.
3.4.1. Open the file '%DEV_DIR_ROOT%\Tools\dmd2\windows\bin\sc.ini' in a
text editor.
 3.4.2. Replace the line with 'LIB=' with the line
'LIB=%DEV_DIR_WINSDK%\Lib\x64;%DEV_DIR_MSVC%\lib\amd64;%@P%\..\lib'.
 3.4.3. Add '-m64 -L/NOLOGO' to  the 'DFLAGS' variable.
3.4.4. Remove the lines with 'VCINSTALLDIR=' and 'WindowsSdkDir='.
 3.4.5. Replace the like with 'LINKCMD64=' with the line
'LINKCMD64=%DEV_DIR_MSVC%\bin\amd64\link.exe'
 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.

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.

--
Bye,
Gor Gyolchanyan.




--
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/


Re: DMD under 64-bit Windows 7 HOWTO

2012-12-18 Thread Walter Bright

On 12/18/2012 5:32 AM, Gor Gyolchanyan wrote:

Good day, fellow D developers.
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.


This belongs in the D wiki.



Re: DMD under 64-bit Windows 7 HOWTO

2012-12-18 Thread Mariusz Gliwiński

On Tuesday, 18 December 2012 at 14:47:55 UTC, Walter Bright wrote:

On 12/18/2012 5:32 AM, Gor Gyolchanyan wrote:

Good day, fellow D developers.
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.
Thanks for this one. Looks like i'll be trying my code on Windows 
:)




This belongs in the D wiki.

http://wiki.dlang.org/Installing_DMD_on_64-bit_Windows_7_(COFF-compatible)


Re: DMD under 64-bit Windows 7 HOWTO

2012-12-18 Thread Gor Gyolchanyan
On Wed, Dec 19, 2012 at 2:04 AM, Mariusz Gliwiński\
alienballa...@gmail.com@puremagic.com wrote:

 On Tuesday, 18 December 2012 at 14:47:55 UTC, Walter Bright wrote:

 On 12/18/2012 5:32 AM, Gor Gyolchanyan wrote:

 Good day, fellow D developers.
 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.

 Thanks for this one. Looks like i'll be trying my code on Windows :)



  This belongs in the D wiki.

 http://wiki.dlang.org/**Installing_DMD_on_64-bit_**
 Windows_7_(COFF-compatible)http://wiki.dlang.org/Installing_DMD_on_64-bit_Windows_7_(COFF-compatible)


Glad to be of help. :-)

-- 
Bye,
Gor Gyolchanyan.


Re: DMD under 64-bit Windows 7 HOWTO

2012-12-18 Thread Rainer Schuetze



On 18.12.2012 14:32, Gor Gyolchanyan wrote:

Good day, fellow D developers.
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.
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.

And here's how this could be arranged:

1. Prepare your development folder.
1.1. Create a folder with no spaces in its full path.
1.2. Store its full path in the '%DEV_DIR_ROOT%' environment variable.
2. Get the Windows SDK.
2.1. Download the Windows SDK.
2.1.1. Navigate to
'http://msdn.microsoft.com/en-US/windows//bb980924.aspx' in a web browser.
2.1.2. Under section 2 (number '2' in a green circle) click on the bold
blue 'Install Now' link.
2.1.3. In the opened window click in the blue 'Download' button at the
bottom of the page.
2.1.4. Make sure, that the Windows SDK installer ('winsdk_web.exe') is
downloaded.
2.2. Install the downloaded Windows SDK.
2.2.1. Navigate to the folder, where the Windows SDK installer was
downloaded in a file browser.
2.2.2. Double-click on the installer and agree to security warnings to
launch it.
2.2.3. Click next, read and agree to the license until you reach the
'Install Locations' screen.
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 '.
2.3.3. On the 'Installation Options' uncheck everything except 'x64
Libraries' and 'Visual C++ Compilers' and click 'Next '.
2.3.4. Confirm that everything is correct and click 'Next ' to start
installing.
2.3.5. Make sure, tata the installation is completed succesfully.
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').
3. Get the DMD.
3.1. Navigate to 'http://ftp.digitalmars.com/dmd2beta.zip
http://ftp.digitalmars.com/dmd2beta..zip' in a web browser.
3.2. Make sure, that the DMD compiler archive ('dmd2beta.zip') is
downloaded.
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'.
3.4. Adapt the compiler configuration to the development environment.
3.4.1. Open the file '%DEV_DIR_ROOT%\Tools\dmd2\windows\bin\sc.ini' in a
text editor.
3.4.2. Replace the line with 'LIB=' with the line
'LIB=%DEV_DIR_WINSDK%\Lib\x64;%DEV_DIR_MSVC%\lib\amd64;%@P%\..\lib'.
3.4.3. Add '-m64 -L/NOLOGO' to  the 'DFLAGS' variable.
3.4.4. Remove the lines with 'VCINSTALLDIR=' and 'WindowsSdkDir='.
3.4.5. Replace the like with 'LINKCMD64=' with the line
'LINKCMD64=%DEV_DIR_MSVC%\bin\amd64\link.exe'
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.

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.


Thanks for doing this. A few notes:

- I don't think it is the best idea to have two copies of the compiler 
to be able to compile for 32-bit and 64-bit targets. That's why I have 
suggested 2 different environment blocks in sc.ini, but the pull request 
has not been merged yet: 
https://github.com/D-Programming-Language/dmd/pull/1220


- With removing VCINSTALLDIR and WindowsSdkDir from sc.ini, you are 
disabling some magic in the linker invocation. I think this is good, the 
resulting settings should be in sc.ini. Please note that the environment 
variables can also be set in the shell environment already (e.g. when 
using the link to starting cmd.exe created by the SDK installer), 
setting them to blank might be a good idea.


- Most people will already have some other version of the linker and the 
SDK installed, e.g. as part of Visual Studio or VC++ Express. I think 
these should be supported aswell. I recently started creating a list of 
common installations but got distracted somehow.


- The Windows 8 SDK uses some other folder hierarchy.

- When building with debug information, the linker needs to load some 
DLLs to generate the PDB file. I had to modify the PATH environment 
variable in sc.ini as well to not get an error, i.e.