www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DMD + msvc

reply Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
Is it possible to use the VC2010 linker with DMD? That would allow
easily linking with COFF libraries and building 64 bit binaries.

-- 
Bye,
Gor Gyolchanyan.
Jun 16 2012
next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2012-06-17 07:15, Gor Gyolchanyan wrote:
 Is it possible to use the VC2010 linker with DMD? That would allow
 easily linking with COFF libraries and building 64 bit binaries.
No. 1. DMD can only output OMF binaries 2. DMD cannot output 64bit code for Windows 3. DMD is not compatible with the MSVC linker or runtime -- /Jacob Carlborg
Jun 17 2012
next sibling parent reply Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
On Sun, Jun 17, 2012 at 2:34 PM, Jacob Carlborg <doob me.com> wrote:
 On 2012-06-17 07:15, Gor Gyolchanyan wrote:
 Is it possible to use the VC2010 linker with DMD? That would allow
 easily linking with COFF libraries and building 64 bit binaries.
No. 1. DMD can only output OMF binaries 2. DMD cannot output 64bit code for Windows 3. DMD is not compatible with the MSVC linker or runtime -- /Jacob Carlborg
Thanks for the reply. This is so ridiculous and frustrating. -- Bye, Gor Gyolchanyan.
Jun 17 2012
next sibling parent "Mehrdad" <wfunction hotmail.com> writes:
On Sunday, 17 June 2012 at 10:49:30 UTC, Gor Gyolchanyan wrote:
 On Sun, Jun 17, 2012 at 2:34 PM, Jacob Carlborg <doob me.com> 
 wrote:
 On 2012-06-17 07:15, Gor Gyolchanyan wrote:
 Is it possible to use the VC2010 linker with DMD? That would 
 allow
 easily linking with COFF libraries and building 64 bit 
 binaries.
No. 1. DMD can only output OMF binaries 2. DMD cannot output 64bit code for Windows 3. DMD is not compatible with the MSVC linker or runtime -- /Jacob Carlborg
Thanks for the reply. This is so ridiculous and frustrating.
Yeah, but do note that even if DMD _was_ compatible with the VC2010 linker, then that still wouldn't get you 64-bit code...
Jun 18 2012
prev sibling parent reply "Kagamin" <spam here.lot> writes:
On Sunday, 17 June 2012 at 10:49:30 UTC, Gor Gyolchanyan wrote:
 Thanks for the reply.
 This is so ridiculous and frustrating.
Use GDC?
Jun 18 2012
next sibling parent Manu <turkeyman gmail.com> writes:
On 18 June 2012 11:38, Kagamin <spam here.lot> wrote:

 On Sunday, 17 June 2012 at 10:49:30 UTC, Gor Gyolchanyan wrote:

 Thanks for the reply.
 This is so ridiculous and frustrating.
Use GDC?
I use GDC now. It produces COFF objects, and is technically capable of linking against MSVC code, except the 2 compilers expect different runtimes. You have to be REALLY careful with your GDC code to make sure it doesn't produce implicit calls into the GNU runtime, otherwise you'll get link conflicts. You can afford some really standard runtime calls that are also present in the mscrt, and it'll just link to those instead of the gnu ones. I have successfully build small scale projects with GDC linking against MSVC code, but there's a long list of problems and gotchas... My current approach is to build D code into DLL's and dynamically link against my MSVC code, or vice-versa. Hopefully the new 64bit dmd comes soon :)
Jun 18 2012
prev sibling parent Iain Buclaw <ibuclaw ubuntu.com> writes:
On 18 June 2012 16:08, Manu <turkeyman gmail.com> wrote:
 On 18 June 2012 11:38, Kagamin <spam here.lot> wrote:
 On Sunday, 17 June 2012 at 10:49:30 UTC, Gor Gyolchanyan wrote:
 Thanks for the reply.
 This is so ridiculous and frustrating.
Use GDC?
I use GDC now. It produces COFF objects, and is technically capable of linking against MSVC code, except the 2 compilers expect different runtimes. You have to be REALLY careful with your GDC code to make sure it doesn't produce implicit calls into the GNU runtime, otherwise you'll get link conflicts. You can afford some really standard runtime calls that are also present in the mscrt, and it'll just link to those instead of the gnu ones. I have successfully build small scale projects with GDC linking against MSVC code, but there's a long list of problems and gotchas... My current approach is to build D code into DLL's and dynamically link against my MSVC code, or vice-versa. Hopefully the new 64bit dmd comes soon :)
DMD would be linking against it's own runtime on windows too, rather than msvc runtime, iirc. So you may have similar problems there too. -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';
Jun 18 2012
prev sibling next sibling parent Sean Kelly <sean invisibleduck.org> writes:
On Jun 17, 2012, at 3:49 AM, Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> w=
rote:

 On Sun, Jun 17, 2012 at 2:34 PM, Jacob Carlborg <doob me.com> wrote:
 On 2012-06-17 07:15, Gor Gyolchanyan wrote:
=20
 Is it possible to use the VC2010 linker with DMD? That would allow
 easily linking with COFF libraries and building 64 bit binaries.
=20 =20 No. =20 1. DMD can only output OMF binaries 2. DMD cannot output 64bit code for Windows 3. DMD is not compatible with the MSVC linker or runtime
=20 Thanks for the reply. This is so ridiculous and frustrating.=20
What about GDC? Makes me wonder how hard it would be to add a cfront option= to DMD. I guess asm blocks make that a bit tricky though.=20=
Jun 17 2012
prev sibling next sibling parent Manu <turkeyman gmail.com> writes:
On 17 June 2012 13:49, Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> wrote:

 On Sun, Jun 17, 2012 at 2:34 PM, Jacob Carlborg <doob me.com> wrote:
 On 2012-06-17 07:15, Gor Gyolchanyan wrote:
 Is it possible to use the VC2010 linker with DMD? That would allow
 easily linking with COFF libraries and building 64 bit binaries.
No. 1. DMD can only output OMF binaries 2. DMD cannot output 64bit code for Windows 3. DMD is not compatible with the MSVC linker or runtime -- /Jacob Carlborg
Thanks for the reply. This is so ridiculous and frustrating.
I've been bugging Walter for this for months, and the word on the street is that he's working on it now :) Intention is to support the MS linker and runtimes (which is what I need too).
Jun 18 2012
prev sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 6/17/2012 3:34 AM, Jacob Carlborg wrote:
 1. DMD can only output OMF binaries
 2. DMD cannot output 64bit code for Windows
 3. DMD is not compatible with the MSVC linker or runtime
I intend to fix all of those, at least for 64 bit Windows, in the near term.
Jun 18 2012
next sibling parent reply "Adam Wilson" <flyboynw gmail.com> writes:
On Mon, 18 Jun 2012 10:50:44 -0700, Walter Bright  
<newshound2 digitalmars.com> wrote:

 On 6/17/2012 3:34 AM, Jacob Carlborg wrote:
 1. DMD can only output OMF binaries
 2. DMD cannot output 64bit code for Windows
 3. DMD is not compatible with the MSVC linker or runtime
I intend to fix all of those, at least for 64 bit Windows, in the near term.
Does this somewhat vague statement meant that we are getting COFF support in the near term? Because if so, I have some serious plans for source embedding in custom sections. The only thing blocking it is the fact that OMF doesn't support custom sections. Once the source is embedded in libraries, we can finally jettison DI files once and for all! Also would it be possible at this point to clean up the backend such that we have a clean interface for interacting with object files during their construction, given that with COFF, all object format wills be roughly feature equal? Object generation is an unholy disaster of IFDEF's and my brain has melted every time I try to venture into it; but if we have a clean interface for interacting with them it would make it significantly easier to add things like custom sections, which in turn will open up a plethora of new options, including source embedding. -- Adam Wilson IRC: LightBender Project Coordinator The Horizon Project http://www.thehorizonproject.org/
Jun 18 2012
next sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 6/18/2012 11:10 AM, Adam Wilson wrote:
 On Mon, 18 Jun 2012 10:50:44 -0700, Walter Bright <newshound2 digitalmars.com>
 wrote:

 On 6/17/2012 3:34 AM, Jacob Carlborg wrote:
 1. DMD can only output OMF binaries
 2. DMD cannot output 64bit code for Windows
 3. DMD is not compatible with the MSVC linker or runtime
I intend to fix all of those, at least for 64 bit Windows, in the near term.
Does this somewhat vague statement meant that we are getting COFF support in the near term?
Yes, because that is necessary for MSVC linker compatibility.
 Because if so, I have some serious plans for source embedding in
 custom sections. The only thing blocking it is the fact that OMF doesn't
support
 custom sections. Once the source is embedded in libraries, we can finally
 jettison DI files once and for all! Also would it be possible at this point to
 clean up the backend such that we have a clean interface for interacting with
 object files during their construction, given that with COFF, all object format
 wills be roughly feature equal?
Probably not, though it will be better.
 Object generation is an unholy disaster of
 IFDEF's and my brain has melted every time I try to venture into it; but if we
 have a clean interface for interacting with them it would make it significantly
 easier to add things like custom sections, which in turn will open up a
plethora
 of new options, including source embedding.
Yeah, me too. But fixing that is not so easy.
Jun 18 2012
next sibling parent Trass3r <un known.com> writes:
 Does this somewhat vague statement meant that we are getting COFF  
 support in the near term?
Yes, because that is necessary for MSVC linker compatibility.
Hooray!
Jun 18 2012
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2012-06-19 01:22, Walter Bright wrote:
 On 6/18/2012 11:10 AM, Adam Wilson wrote:
 Object generation is an unholy disaster of
 IFDEF's and my brain has melted every time I try to venture into it;
 but if we
 have a clean interface for interacting with them it would make it
 significantly
 easier to add things like custom sections, which in turn will open up
 a plethora
 of new options, including source embedding.
Yeah, me too. But fixing that is not so easy.
A start is to have a rigorous set of tests for this part of the compiler. I know the compiler has a test suite but I don't know how much of this particular code is covered. With a rigorous set of tests one will feel more comfortable in refactoring the code. Then it just some hard work that will probably take some time. The first thing would probably be to try to put everything platform specific in one place. Ideally there would only be one set of if-def's. If possible this can happen iteratively in several steps. When a function needs to be changed refactor it as well to make it more clean. Ideally we don't want to the new COFF backend to become a part of this mess. -- /Jacob Carlborg
Jun 18 2012
prev sibling parent Trass3r <un known.com> writes:
 Object generation is an unholy disaster of IFDEF's and my brain has  
 melted
 every time I try to venture into it
Funnily enough, cppcheck shares your opinion on the backend: Interrupted checking because of too many #ifdef configurations
Jun 19 2012
prev sibling next sibling parent reply =?UTF-8?B?Ik1pY2hhw6ts?= Larouche" <michael.larouche gmail.com> writes:
On Monday, 18 June 2012 at 17:51:39 UTC, Walter Bright wrote:
 On 6/17/2012 3:34 AM, Jacob Carlborg wrote:
 1. DMD can only output OMF binaries
 2. DMD cannot output 64bit code for Windows
 3. DMD is not compatible with the MSVC linker or runtime
I intend to fix all of those, at least for 64 bit Windows, in the near term.
This is great news ! For one of my personal projects I wanted to use LLVM with D, after trying to convert the MSVC .lib to OMF format, linking with Win64GDC and MinGW LLVM (but I didn't include all LLVM libs), I gave up and I booted to my Mac partition where the object and the linker are the same for all.
Jun 18 2012
next sibling parent reply Manu <turkeyman gmail.com> writes:
On 18 June 2012 22:07, <michael.larouche gmail.com>" puremagic.com <
"\"Micha=C3=ABl".Larouche"> wrote:

 On Monday, 18 June 2012 at 17:51:39 UTC, Walter Bright wrote:

 On 6/17/2012 3:34 AM, Jacob Carlborg wrote:

 1. DMD can only output OMF binaries
 2. DMD cannot output 64bit code for Windows
 3. DMD is not compatible with the MSVC linker or runtime
I intend to fix all of those, at least for 64 bit Windows, in the near term.
This is great news !
It really is. I suspect we will see a gigantic boots to the D community on the back of this change! :)
Jun 18 2012
parent "Kagamin" <spam here.lot> writes:
On Monday, 18 June 2012 at 20:23:31 UTC, Manu wrote:
 It really is. I suspect we will see a gigantic boots to the D 
 community on
 the back of this change! :)
KickAss would be a cool codename for new object file writing capability in the backend.
Jun 19 2012
prev sibling parent "Jonathan M Davis" <jmdavisProg gmx.com> writes:
On Monday, June 18, 2012 23:23:02 Manu wrote:
 It really is. I suspect we will see a gigantic boots to the D community on
 the back of this change! :)
Well, we could all use a good pair of shoes. ;) - Jonathan M Davis
Jun 18 2012
prev sibling next sibling parent reply "Rene Zwanenburg" <renezwanenburg gmail.com> writes:
On Monday, 18 June 2012 at 17:51:39 UTC, Walter Bright wrote:
 On 6/17/2012 3:34 AM, Jacob Carlborg wrote:
 1. DMD can only output OMF binaries
 2. DMD cannot output 64bit code for Windows
 3. DMD is not compatible with the MSVC linker or runtime
I intend to fix all of those, at least for 64 bit Windows, in the near term.
COFF and 64 bit support for windows are on the top of my wish list for D, so this is great news! A few questions: What do you mean by 'at least for 64 bit windows'? No COFF support when targeting, or building on, 32 bit? 'in the near term': I know it's a hard question, but does that mean a few months, or more like a year? Perhaps we could look into writing a COFF linker in D to replace optlink, that way OMF support can be dropped completely. It'd be cool to have part of the toolchain written in D itself. It's not a high priority though, since the MS linker comes with the free Express editions of Visual Studio. Anyways, this is really exiting. It'll greatly ease use of C libraries on windows, even open-source ones, because most don't compile out-of-the-box with dmc.
Jun 19 2012
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 6/19/2012 7:16 AM, Rene Zwanenburg wrote:
 On Monday, 18 June 2012 at 17:51:39 UTC, Walter Bright wrote:
 On 6/17/2012 3:34 AM, Jacob Carlborg wrote:
 1. DMD can only output OMF binaries
 2. DMD cannot output 64bit code for Windows
 3. DMD is not compatible with the MSVC linker or runtime
I intend to fix all of those, at least for 64 bit Windows, in the near term.
COFF and 64 bit support for windows are on the top of my wish list for D, so this is great news! A few questions: What do you mean by 'at least for 64 bit windows'? No COFF support when targeting, or building on, 32 bit?
Right. Frankly, I think the future is all 64 bits. That future is already here on the Mac, where supporting 32 bits seems more and more of a backwater.
 'in the near term': I know it's a hard question, but does that mean a few
 months, or more like a year?
On the order of months.
 Perhaps we could look into writing a COFF linker in D to replace optlink, that
 way OMF support can be dropped completely. It'd be cool to have part of the
 toolchain written in D itself.
I'd love to do that, but I can't spare the month or so to do it.
Jun 19 2012
parent reply Adam Wilson <flyboynw gmail.com> writes:
Walter Bright wrote:
 On 6/19/2012 7:16 AM, Rene Zwanenburg wrote:
 On Monday, 18 June 2012 at 17:51:39 UTC, Walter Bright wrote:
 On 6/17/2012 3:34 AM, Jacob Carlborg wrote:
 1. DMD can only output OMF binaries
 2. DMD cannot output 64bit code for Windows
 3. DMD is not compatible with the MSVC linker or runtime
I intend to fix all of those, at least for 64 bit Windows, in the near term.
COFF and 64 bit support for windows are on the top of my wish list for D, so this is great news! A few questions: What do you mean by 'at least for 64 bit windows'? No COFF support when targeting, or building on, 32 bit?
Right. Frankly, I think the future is all 64 bits. That future is already here on the Mac, where supporting 32 bits seems more and more of a backwater.
 'in the near term': I know it's a hard question, but does that mean a few
 months, or more like a year?
On the order of months.
 Perhaps we could look into writing a COFF linker in D to replace
 optlink, that
 way OMF support can be dropped completely. It'd be cool to have part
 of the
 toolchain written in D itself.
I'd love to do that, but I can't spare the month or so to do it.
Is there any reason we the community could not do this work? You need to focus on the compiler. And with the ability to use the linkers available on each system, the need for this drops drastically. The primary use case would become portability and special case features. -- Adam Wilson IRC: LightBender Project Coordinator The Horizon Project http://www.thehorizonproject.org/
Jun 19 2012
parent Walter Bright <newshound2 digitalmars.com> writes:
On 6/19/2012 11:33 AM, Adam Wilson wrote:
 Is there any reason we the community could not do this work? You need to focus
 on the compiler. And with the ability to use the linkers available on each
 system, the need for this drops drastically. The primary use case would become
 portability and special case features.
No, there's no reason the community could not do it.
Jun 19 2012
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2012-06-18 19:50, Walter Bright wrote:
 On 6/17/2012 3:34 AM, Jacob Carlborg wrote:
 1. DMD can only output OMF binaries
 2. DMD cannot output 64bit code for Windows
 3. DMD is not compatible with the MSVC linker or runtime
I intend to fix all of those, at least for 64 bit Windows, in the near term.
Now why isn't that on the dlang.org site in a road map or similar. Why do we always need to dig deep in threads like this on the newsgroup to found this useful information. This is probably so important that we can have it on the front page. Something like "What's currently being worked on" and "Latest news". -- /Jacob Carlborg
Jun 21 2012
prev sibling parent Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 17.06.2012 9:15, Gor Gyolchanyan wrote:
 Is it possible to use the VC2010 linker with DMD? That would allow
 easily linking with COFF libraries and building 64 bit binaries.
You can do it with UniLink, as it's able to link OMF & COFF together. The problem is that there is no 64 bit object file generator on Windows. Last time I've heard about it Walter & co investigated on which way to go w.r.t. 64bit toolchain on Windows. -- Dmitry Olshansky
Jun 17 2012