fix issue 11961: allow selecting the MS C runtime to link against#6244
fix issue 11961: allow selecting the MS C runtime to link against#6244WalterBright merged 1 commit intodlang:masterfrom
Conversation
|
|
Corresponding library changes: dlang/druntime#1691 and dlang/phobos#4891 |
| else | ||
| { | ||
| const(char)* m32mscoff = ""; | ||
| const(char)* mscrtlib = ""; |
There was a problem hiding this comment.
What happened to the default value of "LIBCMD"?
There was a problem hiding this comment.
You are looking at the usage message here. The default is set after command line parsing below: https://github.com/dlang/dmd/pull/6244/files#diff-2a089032228a74524c0933f9bd7e71deR1027
| static if (TARGET_WINDOS) | ||
| { | ||
| const(char)* m32mscoff = "\n -m32mscoff generate 32 bit code and write MS-COFF object files"; | ||
| const(char)* mscrtlib = "\n -mscrtlib=<name> MS C runtime library to reference from main/WinMain/DllMain"; |
There was a problem hiding this comment.
Perhaps add text (default is LIBCMD) ?
There was a problem hiding this comment.
I tried to avoid that the text spans 2 lines. Maybe this is no longer a concern as the console in Windows 10 can be resized to have more than 80 characters. There is no precedent that shows the default, though (e.g. -conf, -defaultlib).
|
Once we have dll support this is going to be more of a problem because phobos/druntime will be build against a specific version of the msvc c-runtime. We will have to see what we do then. |
The default might change depending on other command line switches (-debug, -shared). I was about to commit this with a change that would implement https://issues.dlang.org/show_bug.cgi?id=10316, but hesitated in the last moment to not mix two issues. |
I'm actually already doing that. When you pass -shared in my version of dmd it links against msvcrt by default instead of libcmd. What I meant is that we would have to ship multiple binary version of shared druntime/phobos and select a appropriate one depending on the switches passed. |
|
Auto-merge toggled on |
Thanks. The documentation change is here: dlang/dlang.org#1513 |
This allows linking seamlessly against other C runtime versions (libcmtd, msvcrt, msvcrtd) when interfacing with MS C/C++.
phobos.lib is agnostic to the selected runtime, but to get rid of the embedded library dependencies it needs to be built slightly different. PRs are coming...