Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
October 25, 2017 DMD, Windows and C | ||||
---|---|---|---|---|
| ||||
In preparation for an upcoming blog series, and partly as a reaction to the "Windows is a second-class citizen" criticisms that have been cropping up lately, I've put together a primer on getting set up to use C and D together on Windows. It includes some background on why we need to install the MS toolchain to produce 64-bit binaries. The blog: https://dlang.org/blog/2017/10/25/dmd-windows-and-c/ Reddit: https://www.reddit.com/r/programming/comments/78olka/dmd_windows_and_c_getting_set_up_to_use_d_and_c/ |
October 25, 2017 Re: DMD, Windows and C | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Parker | On Wednesday, 25 October 2017 at 16:05:48 UTC, Mike Parker wrote: > In preparation for an upcoming blog series, and partly as a reaction to the "Windows is a second-class citizen" criticisms that have been cropping up lately, I've put together a primer on getting set up to use C and D together on Windows. It includes some background on why we need to install the MS toolchain to produce 64-bit binaries. > > The blog: > https://dlang.org/blog/2017/10/25/dmd-windows-and-c/ > > Reddit: > https://www.reddit.com/r/programming/comments/78olka/dmd_windows_and_c_getting_set_up_to_use_d_and_c/ LLVM's LLD is another option for linking on Windows (and cross-linking to Windows from other platforms); they used not to support debuginfos (.pdb), not sure what the current state is. `lld-link.exe` and `llvm-lib.exe` work as drop-in replacements, reading the same environment variables and exposing the same command-line interface. Recent LDC integrates both the linker and the archiver/librarian (in the LDC executable directly - increasing the size of the LDC executable by about 10% IIRC). The MS libs are obviously still required. They can be compressed to ~32 MB. The redistribution of the static libs is unclear, that's why I haven't pursued this further, but that's basically the only thing standing in the way of releasing a fully self-contained LDC package with a compressed size of roughly 50 MB (64-bit libs only). See https://github.com/ldc-developers/ldc/pull/2142#issuecomment-304472412. |
October 25, 2017 Re: DMD, Windows and C | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Parker | On Wednesday, 25 October 2017 at 16:05:48 UTC, Mike Parker wrote: > In preparation for an upcoming blog series, and partly as a reaction to the "Windows is a second-class citizen" criticisms that have been cropping up lately, I've put together a primer on getting set up to use C and D together on Windows. It includes some background on why we need to install the MS toolchain to produce 64-bit binaries. > > The blog: > https://dlang.org/blog/2017/10/25/dmd-windows-and-c/ > > Reddit: > https://www.reddit.com/r/programming/comments/78olka/dmd_windows_and_c_getting_set_up_to_use_d_and_c/ Great post. Small typo in: "https:/www/visualstudio.com." Most often it's not that I personally have some library in C that I need to compile and link to D. I'd rather just use D, all else equal. The problem is that you have some code base written in C by someone else and I want to use that. For instance, I was recently looking at LAPACK http://icl.cs.utk.edu/lapack-for-windows/lapack/ and you just beat your head against the wall figuring out what you need to do. Okay, I don't have the intel compiler, and I'm pretty sure a MinGW version won't work. So there's some VS solution, but that didn't work for me. So then I thought about building it, but if you look at the instructions it requires either the Intel compiler or MinGW. After about a half an hour, I want to throw up my hands and only use Linux, but I have to use Windows at work. |
October 25, 2017 Re: DMD, Windows and C | ||||
---|---|---|---|---|
| ||||
Posted in reply to kinke | On Wednesday, 25 October 2017 at 16:57:27 UTC, kinke wrote:
> The MS libs are obviously still required. They can be compressed to ~32 MB. The redistribution of the static libs is unclear, that's why I haven't pursued this further, but that's basically the only thing standing in the way of releasing a fully self-contained LDC package with a compressed size of roughly 50 MB (64-bit libs only).
I wish we had zero-dependence distributions of all compilers for Windows. I want to redist compiler with my application for easy modding. And requiring VisualStudio / BuildToos is too much garbage for a small task. (Ideally it should be 20-30 MB at max).
|
October 26, 2017 Re: DMD, Windows and C | ||||
---|---|---|---|---|
| ||||
Posted in reply to MrSmith | On 2017-10-25 21:15, MrSmith wrote: > I wish we had zero-dependence distributions of all compilers for Windows. I want to redist compiler with my application for easy modding. And requiring VisualStudio / BuildToos is too much garbage for a small task. (Ideally it should be 20-30 MB at max). I wish we had that for all platforms. -- /Jacob Carlborg |
October 26, 2017 Re: DMD, Windows and C | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Parker |
On 25.10.2017 18:05, Mike Parker wrote:
> In preparation for an upcoming blog series, and partly as a reaction to the "Windows is a second-class citizen" criticisms that have been cropping up lately, I've put together a primer on getting set up to use C and D together on Windows. It includes some background on why we need to install the MS toolchain to produce 64-bit binaries.
>
> The blog:
> https://dlang.org/blog/2017/10/25/dmd-windows-and-c/
>
> Reddit:
> https://www.reddit.com/r/programming/comments/78olka/dmd_windows_and_c_getting_set_up_to_use_d_and_c/
>
Thanks for the nice article. Two minor remarks:
- the D installer already creates batch files dmd2vars32.bat and dmd2vars64.bat that modify the PATH environment variable (but don't include the DMC path)
- DMD doesn't need lib.exe to build static libraries, that's built into DMD.
|
October 26, 2017 Re: DMD, Windows and C | ||||
---|---|---|---|---|
| ||||
Posted in reply to kinke |
On 25.10.2017 18:57, kinke wrote:
> On Wednesday, 25 October 2017 at 16:05:48 UTC, Mike Parker wrote:
>> In preparation for an upcoming blog series, and partly as a reaction to the "Windows is a second-class citizen" criticisms that have been cropping up lately, I've put together a primer on getting set up to use C and D together on Windows. It includes some background on why we need to install the MS toolchain to produce 64-bit binaries.
>>
>> The blog:
>> https://dlang.org/blog/2017/10/25/dmd-windows-and-c/
>>
>> Reddit:
>> https://www.reddit.com/r/programming/comments/78olka/dmd_windows_and_c_getting_set_up_to_use_d_and_c/
>>
>
> LLVM's LLD is another option for linking on Windows (and cross-linking to Windows from other platforms); they used not to support debuginfos (.pdb), not sure what the current state is. `lld-link.exe` and `llvm-lib.exe` work as drop-in replacements,
I tried lld-link just yesterday on a small DMD generated test file. Apart from not supporting the /MAP option it worked without debug information, but choked on debug symbols.
|
Copyright © 1999-2021 by the D Language Foundation