www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Hipreme's #3 Tip of the day - Changing DMD linker on Windows

reply Hipreme <msnmancini hotmail.com> writes:
The linker used on Windows when installing DMD is pretty much 
decided on how your PC was setup.

- If you had Visual Studio installed on your windows for "Desktop 
Development with C++" before downloading DMD (from the site and 
setup), you will pretty have MSVC Linker as a default.
- If you installed DMD before Visual Studio without that 
extension, your default linker will be LLD linker.

There is 2 ways to change your linker for DMD:

1. Open a Command Prompt and type `set 
LINKCMD=path\to\the\linker`.
2. Open your D windows installation folder (usually 
C:\D\dmd2\windows\bin), and edit `sc.ini`. There will be 
[Environment]. Below [Environment], you just type the same thing 
as above. So basically, for my folder system, I can use both:

**LLD**:
`LINKCMD=C:\D\dmd2\windows\bin\lld-link.exe`
**MSVC**:
`LINKCMD=C:\Program Files\Microsoft Visual 
Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\Hostx86\x64\link.exe`

Notice that there is no `""` (string literal), although you can 
find that on other places, that actually causes an error on 
windows.

This can be useful for making your program link faster (lld is 
well known for that). But there are cases that you're going to 
need the MSVC one. Specially today that I was getting the error 
while trying to build with LLD:

Error 0xc00007b “Application was unable to start correctly”


This was solved after changing my linker back to MSVC.
Nov 01 2022
parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Tuesday, 1 November 2022 at 16:17:08 UTC, Hipreme wrote:
 The linker used on Windows when installing DMD is pretty much 
 decided on how your PC was setup.

 [...]
Do you have a blog?
Nov 03 2022