New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-9995] Figure out how to properly handle /MT{,d} and /MD{,d} #52398
Comments
One of the fun side effects of this is that you can't do the equivalent of, for example, |
I think we should focus on /MD{,d} first, and worry about "everything statically-linked" later. Would we need to build and distribute two copies of the standard library, then? Do we want to treat these as different architectures or architecture-environments? (i.e. lib/swift/windows/x86_64-debug) |
@belkadan - yes, this will require distribution of multiple standard libraries. I say multiple, because we will need 4 runtime libraries (/MD, /MDd, /MT, /MTd). I think that we want to treat this more like Microsoft and have suffixes instead. `swiftCore.dll` and `swiftCored.dll` which reside in the same directory. |
Is that better than different directories? Seems harder, especially with autolinking. swift_static wasn't really the best idea, but it's closer to that, right? |
We now can do `-libc MD` or `-libc MDd` (or for those that like verbose names: `-libc MultiThreadedDLL` or `-libc MultiThreadedDebugDLL` to match Visual Studio and CMake). |
I think that its definitely easier than the `swift_static`. It avoids the complexity of changing search directories and install behaviour based on the configuration. The way that `-libc` works is that it already configures the autolinking so it just becomes this very simple thing of specifying the flag properly. |
Yes, but you need to do that for the WinSDK overlay too, no? |
Right, the SDK overlay would be built similarly, with the `d` suffixed variants - e.g. swiftMSVCRTd.dll. We could use the `-module-name` and `-module-link-name` options to get it behave the same - that is, the user still says `import MSVCRT` but gets the `swiftMSVCRTd.lib` import library at link time. The one complication to this would be the `swiftrt.obj` that needs the variants as well. |
I'd go with the |
Additional Detail from JIRA
md5: 7beffdd6fe2309d512947c81cff65724
Parent-Task:
Issue Description:
Windows has 4 different modes of building:
/MTd - single threaded, statically linked, debug
/MT - single threaded, statically linked, release
/MDd - dynamic MSVCRT, debug
/MD - dynamic MSVCRT
You cannot mix and match the builds with these as they impact the ABI of the C types. We have a few places where we workaround this by manually recreating `/MD` builds.
The text was updated successfully, but these errors were encountered: