Anticipate the usage of Visual Studio 2017 Developer Command Prompt?

Andre Pany andre at s-e-a-p.de
Fri Nov 3 11:52:10 UTC 2017


Hi,

Visual Studio has a batch file which sets all needed environment 
variables for the Microsoft linker (LIB environment variables 
points to all necessary folders). Even the folder containing the 
link.exe for the specified architecture (x86, amd64) is added to 
the path variable as first path.

> vsdevcmd -arch=amd64

As the sc.ini targets the windows development (visuals studio) 
after calling the developer command prompt, dmd should be able to 
compile -m32mscoff, -m64 out of the box without the need to 
change anything within sc.ini.

There is even a comment in sc.ini which points in this direction:
; Add the library subdirectories of all VC and Windows SDK 
versions so things
; just work for users using dmd from the VS Command Prompt

Unfortunately it does not work for various reasons:
- optlink has the filename link.exe which conflicts with the 
filename of the microsoft linker
- from my investigation I have the assumption that even if an 
environment variable LIB exists, the value is discarded by the 
sc.ini logic. I tried hard, but it seems existing environment 
variable LIB cannot be used in sc.ini

If you can use the windows installer, it will set the right 
values in sc.ini. But there are scenarios in which you cannot use 
the windows installer but have to use the dmd zip archive (build 
infrastructure scripts).

In my scenario it seems the only possibility is to adapt my build 
infrastructure scripts to:
- extract dmd archive
- delete link.exe (optlink)
- modify the sc.ini

That is a solution for my case, but my gut feeling is, it should 
be solved in general
to ease the usage of the microsoft linker.

I thought it was planned to rename the optlink link.exe to 
optlink.exe?

Kind regards
André




More information about the Digitalmars-d mailing list