@wader Now, with #Windows10, there was finally a new and modern C runtime available, #UCRT. In theory, this solves all your problems with C programs on Windows. In practice, as long as you expect your users to use your software on *older* Windows versions, it's not a good option 😞

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