www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - 64bit linking on Windows without Visual Studio

reply "Jeremiah DeHaan" <dehaan.jeremiah gmail.com> writes:
Hey all,

While browsing the other day I stumbled across a linker called 
polink (part of the Pelles C suite). After only a few tries I got 
a working 64bit Hello World executable to be produced using it. 
The terms of service is incredibly permissive, and it looks like 
we can use it how ever we want (though this would need 
confirmation). I'm wondering if this could be a possible 
replacement for needing to install Visual Studio along side the D 
compiler.

Thoughts?
Apr 19 2015
next sibling parent ketmar <ketmar ketmar.no-ip.org> writes:
On Mon, 20 Apr 2015 04:05:19 +0000, Jeremiah DeHaan wrote:

 Hey all,
=20
 While browsing the other day I stumbled across a linker called polink
 (part of the Pelles C suite). After only a few tries I got a working
 64bit Hello World executable to be produced using it. The terms of
 service is incredibly permissive, and it looks like we can use it how
 ever we want (though this would need confirmation). I'm wondering if
 this could be a possible replacement for needing to install Visual
 Studio along side the D compiler.
=20
 Thoughts?
i think that even if it can't be distributed with DMD, it would be great=20 to write about it in Wiki, so we can direct people there.=
Apr 19 2015
prev sibling parent reply "Joakim" <dlang joakim.fea.st> writes:
On Monday, 20 April 2015 at 04:05:21 UTC, Jeremiah DeHaan wrote:
 Hey all,

 While browsing the other day I stumbled across a linker called 
 polink (part of the Pelles C suite). After only a few tries I 
 got a working 64bit Hello World executable to be produced using 
 it. The terms of service is incredibly permissive, and it looks 
 like we can use it how ever we want (though this would need 
 confirmation). I'm wondering if this could be a possible 
 replacement for needing to install Visual Studio along side the 
 D compiler.

 Thoughts?
There are three aspects of Visual Studio used for D's Win64 support: the Microsoft C compiler to compile a few C files in COFF64 format, the Microsoft COFF64 linker, and the Microsoft C library in COFF64 format. Replacing only one will not get you very far.
Apr 19 2015
parent reply "Jeremy DeHaan" <dehaan.jeremiah gmail.com> writes:
On Monday, 20 April 2015 at 04:32:32 UTC, Joakim wrote:
 There are three aspects of Visual Studio used for D's Win64 
 support: the Microsoft C compiler to compile a few C files in 
 COFF64 format, the Microsoft COFF64 linker, and the Microsoft C 
 library in COFF64 format.  Replacing only one will not get you 
 very far.
As ifor the C compiler, wth DDMD around the corner that seems like it well be a non issue very soon. Really, all we would need are the linker and the libraries, right? I could still do more fiddling, but when I used this linker I used the library files that came with it almost exclusively. There was only one that I needed to add, and I'm sure that it can be figured out. I just really like the idea of a self contained D compiler set up that doesn't need any other downloads to get working.
Apr 20 2015
parent reply "Joakim" <dlang joakim.fea.st> writes:
On Monday, 20 April 2015 at 16:39:38 UTC, Jeremy DeHaan wrote:
 As ifor the C compiler, wth DDMD around the corner that seems 
 like it well be a non issue very soon. Really, all we would 
 need are the linker and the libraries, right? I could still do 
 more fiddling, but when I used this linker I used the library 
 files that came with it almost exclusively. There was only one 
 that I needed to add, and I'm sure that it can be figured out.

 I just really like the idea of a self contained D compiler set 
 up that doesn't need any other downloads to get working.
The C compiler isn't to compile dmd, but some C files that are necessary for druntime and phobos. btw, DDMD only translates the frontend to D, the dmd backend is still C++. Not that it matters, as we're only talking about what's necessary from Visual Studio, and you don't need Visual Studio to compile dmd for Win64. If your alternate toolchain comes with its own C library, then it's much closer to a possible replacement. All you're missing is a C compiler that will compile to COFF64 then.
Apr 20 2015
parent reply "Jeremiah DeHaan" <dehaan.jeremiah gmail.com> writes:
On Monday, 20 April 2015 at 16:47:53 UTC, Joakim wrote:
 The C compiler isn't to compile dmd, but some C files that are 
 necessary for druntime and phobos.  btw, DDMD only translates 
 the frontend to D, the dmd backend is still C++.  Not that it 
 matters, as we're only talking about what's necessary from 
 Visual Studio, and you don't need Visual Studio to compile dmd 
 for Win64.

 If your alternate toolchain comes with its own C library, then 
 it's much closer to a possible replacement.  All you're missing 
 is a C compiler that will compile to COFF64 then.
Oh, huh. For some reason I thought that DMD was doing its own code generation and only needed a linker for putting it all together. I didn't know that it needed another compiler to work. It looks like I have more to learn about the D compiler. The toolchain I am suggesting does include a C compiler that works for both 32 and 64 bit MSCOFF, so it sounds like it could be feasible, but whether it is worth it or not is a different story.
Apr 20 2015
next sibling parent ketmar <ketmar ketmar.no-ip.org> writes:
On Mon, 20 Apr 2015 18:26:15 +0000, Jeremiah DeHaan wrote:

 Oh, huh. For some reason I thought that DMD was doing its own code
 generation
it does. but to compile DMD itself, even in DDMD form, you still need C++=20 compiler, as codegen part is still in C++ and will not be translated to D. so DDMD is a chimera with top part in D and bottom part in C++. ;-)=
Apr 20 2015
prev sibling parent "Joakim" <dlang joakim.fea.st> writes:
On Monday, 20 April 2015 at 18:26:16 UTC, Jeremiah DeHaan wrote:
 Oh, huh. For some reason I thought that DMD was doing its own
 code generation and only needed a linker for putting it all
 together. I didn't know that it needed another compiler to work.
 It looks like I have more to learn about the D compiler.
DMD does do all its own code generation, the C compiler is only needed for a few C files that are bundled with druntime and phobos, such as zlib. Since the C compiler is only needed to build druntime/phobos for Win64 and not when distributing dmd for Win64, it's not as important as the COFF64 linker and C library. The D devs can always download Visual Studio when building the dmd release, compile those C files, and not require users to get Visual Studio. Of course, this assumes that there aren't any incompatibilities between COFF64 code generated by the Microsoft C compiler and your COFF64 linker and C library.
 The toolchain I am suggesting does include a C compiler that
 works for both 32 and 64 bit MSCOFF, so it sounds like it could
 be feasible, but whether it is worth it or not is a different
 story.
Huh, looks like you have everything you need then. :)
Apr 20 2015