Nice, Linux-behavior on Windows - dynamically linking against the #UCRT, and statically linking against #VCRuntime.

This does work without relying on WindowsAppSdk or other "new" stuff really. Just reproduced in a plain C++-project. No more heap corruption when returning std::string.

https://github.com/microsoft/WindowsAppSDK/blob/main/docs/Coding-Guidelines/HybridCRT.md

#HybridCRT

WindowsAppSDK/docs/Coding-Guidelines/HybridCRT.md at main · microsoft/WindowsAppSDK

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet. - microsoft/WindowsAppSDK

GitHub
#MSVC #HybridCRT - Might solve my issues with passing STL objects over a DLL interface with static linking the CRT.