Skip to content

fix issue 11961: allow selecting the MS C runtime to link against#6244

Merged
WalterBright merged 1 commit intodlang:masterfrom
rainers:select_mscrtlib
Nov 9, 2016
Merged

fix issue 11961: allow selecting the MS C runtime to link against#6244
WalterBright merged 1 commit intodlang:masterfrom
rainers:select_mscrtlib

Conversation

@rainers
Copy link
Member

@rainers rainers commented Nov 6, 2016

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...

@dlang-bot
Copy link
Contributor

Fix Bugzilla Description
11961 Can't select CRT to link against

@rainers
Copy link
Member Author

rainers commented Nov 6, 2016

Corresponding library changes: dlang/druntime#1691 and dlang/phobos#4891
If approved, I'll add a documentation PR, too.

else
{
const(char)* m32mscoff = "";
const(char)* mscrtlib = "";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened to the default value of "LIBCMD"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see.

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";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps add text (default is LIBCMD) ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@Ingrater
Copy link
Contributor

Ingrater commented Nov 7, 2016

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.

@rainers
Copy link
Member Author

rainers commented Nov 7, 2016

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.

@Ingrater
Copy link
Contributor

Ingrater commented Nov 7, 2016

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.

@WalterBright
Copy link
Member

Auto-merge toggled on

@rainers
Copy link
Member Author

rainers commented Nov 9, 2016

Auto-merge toggled on

Thanks. The documentation change is here: dlang/dlang.org#1513

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants