Upgrade your code to the Universal CRT
The Microsoft C Runtime Library (CRT) was refactored in Visual Studio 2015. The Standard C Library, POSIX extensions and Microsoft-specific functions, macros, and global variables were moved into a new library, the Universal C Runtime Library (Universal CRT or UCRT). The compiler-specific components of the CRT were moved into a new vcruntime library. The UCRT is now a Windows component, and ships as part of Windows 10 and later. The UCRT supports a stable ABI based on C calling conventions, and it conforms closely to the ISO C99 standard, with only a few exceptions. It's no longer tied to a specific version of the compiler. You can use the UCRT on any version of Windows supported by Visual Studio 2015 or Visual Studio 2017. The benefit is that you no longer need to update your builds to target a new version of the CRT with every upgrade of Visual Studio. This refactoring has changed the names or locations of many CRT header files, library files, and Redistributable files, and the deployment methods required for your code. Many functions and macros in the UCRT were also added or changed to improve standards conformance. To take advantage of these changes, you must update your existing code and project build systems. As a Windows component, the UCRT library files and headers are now part of the Windows software development kit (SDK). When you install Visual Studio, the parts of the Windows SDK required to use the UCRT are also installed. The Visual Studio installer adds the locations of the UCRT headers, libraries and DLL files to the default paths used by the Visual Studio project build system. When you update your Visual Studio C++ projects, if they use the default project settings, the IDE automatically finds the new locations for header files. And, the linker automatically uses the new default UCRT and vcruntime libraries. Similarly, if you use a Developer command prompt to do command-line builds, the environment variables that contain paths for headers and libraries are updated and work automatically as well. The Standard C Library header files are now found in the Windows SDK in an include folder in an SDK version-specific directory. A typical location for the header files is in the Program Files or Program Files (x86) directory under The UCRT static libraries and dynamic link stub libraries are found in the Program Files or Program Files (x86) directory under The retail and debug UCRT DLLs are found in separate locations. The retail DLLs are Redistributable files, and can be found in the Program Files or Program Files (x86) directory under The C and C++ compiler-specific runtime support library, In Visual Studio 2017, 2019, and 2022, the header files are found under The link libraries are found under The retail and debug versions of the static library are When you update your Visual Studio C++ projects, if you have set the project's Linker property Ignore All Default Libraries to Yes, or if you use the Because the UCRT is now a Microsoft Windows operating system component, it's included as part of the operating system in Windows 10 and later. It's available through Windows Update for older operating systems, Windows Vista through Windows 8.1. A Redistributable version is available for Windows XP. As an operating system component, UCRT updates and servicing are managed by Windows Update independently of Visual Studio and Microsoft C++ compiler versions. Because the UCRT is a Windows component, for security and ease of updates, and a smaller image size, we strongly recommend you use the Redistributable package to do central deployment of the UCRT for your app. You can use the UCRT on any version of Windows supported by Visual Studio 2015 or later. You can redistribute it using a App-local deployment of the UCRT is supported, though not recommended for both performance and security reasons. The DLLs for app-local deployment of the UCRT are included as part of the Windows SDK, under the Many functions were added or updated in the UCRT to improve ISO C99 conformance, and to address code quality and security issues. In some cases, this required breaking changes to the library. Your code that compiled cleanly when using an older version of the CRT may break when you compile it using the UCRT. If so, you must change your code to take advantage of UCRT updates and features. For a detailed listing of the breaking changes and updates to the CRT found in the Universal CRT, see the C Runtime Library (CRT) section of the Visual C++ change history. It includes a list of affected headers and functions that you can use to identify the changes needed in your code. |
|