Bug 11962 – VisualD needs an option to choose the CRT to link against
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
visuald
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2014-01-21T18:07:00Z
Last change time
2014-04-12T10:12:08Z
Assigned to
nobody
Creator
turkeyman
Comments
Comment #0 by turkeyman — 2014-01-21T18:07:20Z
VisualD needs an option in the project settings to choose the CRT to link against.
DMD seems to always link LIBCMT.LIB by default, and I can't find how to change that, particularly for debug builds where the debug variant should be used.
Comment #1 by code — 2014-01-22T01:33:53Z
This might be a duplicate of bug 10316
Comment #2 by turkeyman — 2014-01-22T02:18:16Z
(In reply to comment #1)
> This might be a duplicate of bug 10316
I'm suggesting an option to explicitly choose which one to link be made available in the VisualD project settings. You're suggesting that the default should change when -debug is supplied.
I think both are valid bugs. But they are definitely different issues.
Comment #3 by code — 2014-01-22T02:31:46Z
But don't you agree that they have the same root cause? At least they are related.
Comment #4 by turkeyman — 2014-01-22T03:09:20Z
Sure, they're both related to the CRT to linkage.
I think you're reading too much into the second sentence of my OP. The 'cause' of this bug specifically is that VisualD doesn't present an option in the project settings.
That's unrelated to DMD's choice of default, although sure, the reason I was motivated to look for the option was that I wanted to change it for debug builds, though there are many other cases where you want to choose a different CRT too.
The full suite of CRT's should be available to choose from. Linking against various libraries demand that you choose different libs, and there are also times where you'd rather link to the DLL than statically.
Comment #5 by r.sagitario — 2014-02-09T13:50:20Z
A reference to LIBCMT is added by dmd to the object file that contains main, and it is generated to the C modules in phobos.lib.
I don't think Visual D can do anything about changing it but to add /NODEFAULTLIB to the linker. Would that be good enough?
Comment #6 by turkeyman — 2014-02-09T19:22:50Z
(In reply to comment #5)
> A reference to LIBCMT is added by dmd to the object file that contains main,
> and it is generated to the C modules in phobos.lib.
> I don't think Visual D can do anything about changing it but to add
> /NODEFAULTLIB to the linker. Would that be good enough?
It sounds like DMD needs to introduce this concept as a compile flag, and VisualD needs to add an option in the project settings to select (just like in C++).
I'd suggest a workaround that VisualD can implement immediately would be to use /NODEFAULTLIB by default, and also offer the option in the project settings to choose the CRT to link explicitly? The project option could then be switched to support a proper DMD compile flag at a later time when DMD adds such a thing?
(In reply to comment #7)
> I have added an option to choose the C runtime in the new beta:
> https://github.com/D-Programming-Language/visuald/releases/tag/v0.3.38beta4
>
> It just adds "/NODEFAULTLIB:libcmt msvcrt.lib", for example, to the linker
> command line.
Awesome, this is much needed.
I think Walter is also looking at making proper options for this stuff in DMD too.
Cheers.
Comment #9 by turkeyman — 2014-02-28T07:53:44Z
I just noticed there's a typo in the selection menu.
You list 'Dynamic Release' twice, the second should be 'Dynamic Debug'.
Also, it would be best to make debug builds default to the debug one if not explicitly selected, VS2012 won't link against the release one anymore in debug builds.
Comment #10 by r.sagitario — 2014-03-02T08:37:05Z
(In reply to comment #9)
> I just noticed there's a typo in the selection menu.
> You list 'Dynamic Release' twice, the second should be 'Dynamic Debug'.
Thanks, I fixed this.
> Also, it would be best to make debug builds default to the debug one if not
> explicitly selected, VS2012 won't link against the release one anymore in debug
> builds.
Makes sense, I have changed this, too.
Comment #11 by turkeyman — 2014-03-02T08:39:59Z
Awesome, cheers! :)
Hopefully these can be switched for proper DMD options soon.