Windows SDK C++ Libraries

Runtime Component Documentation

Runtime Libraries

This section details the core runtime libraries provided with the Windows SDK for C++ development. These libraries are essential for the execution and behavior of your applications on Windows.

C++ Runtime Library (MSVCPRT)

The C++ Runtime Library (often referred to as the Standard Library or STL implementation) provides fundamental classes and functions for C++ programming, including:

  • Standard template containers (e.g., std::vector, std::map)
  • Algorithms (e.g., std::sort, std::find)
  • I/O streams (e.g., std::cout, std::cin)
  • String manipulation (e.g., std::string)
  • Exception handling
  • Memory management

Key headers include:

  • <vector>
  • <string>
  • <iostream>
  • <algorithm>
  • <memory>

Universal CRT (ucrtbase.dll)

The Universal C Runtime provides a standardized C library that is included with Windows. It is the default C runtime for UWP applications and is recommended for desktop applications as well.

It includes standard C library functions and support for features like:

  • Standard I/O (stdio.h)
  • String manipulation (string.h)
  • Math functions (math.h)
  • Time functions (time.h)
  • Memory allocation (stdlib.h)

You will typically link against the Universal CRT automatically when using modern Visual Studio C++ toolchains.

Windows Core Runtime Libraries

These libraries are fundamental for interacting with the Windows operating system at a low level. They are often used implicitly by higher-level APIs.

Kernel32.lib / Kernel32.dll

Provides core operating system services, including:

  • Process and thread management
  • Memory management
  • File and I/O operations
  • Synchronization primitives

User32.lib / User32.dll

Responsible for the Windows user interface, including:

  • Window management
  • Message handling
  • User input (keyboard, mouse)
  • GDI (Graphics Device Interface) functions

GDI32.lib / Gdi32.dll

Provides graphics drawing capabilities, including:

  • Drawing lines, shapes, text
  • Managing pens, brushes, fonts
  • Printer support

Common Runtime Components

A selection of commonly used runtime components and their primary functions:

Library/DLL Primary Purpose Key Functions/APIs
msvcrt.dll Older C Runtime (legacy) printf, malloc, strcpy
ucrtbase.dll Universal C Runtime printf, malloc, strcpy, fopen
msvcp140.dll C++ Standard Library (VS 2015-2022) std::vector, std::string, std::cout
kernel32.dll Core OS Services CreateProcess, ReadFile, CloseHandle
user32.dll User Interface Management CreateWindow, MessageBox, GetMessage
gdi32.dll Graphics Device Interface TextOut, Rectangle, CreateFont
combase.dll COM Infrastructure COM object creation, interfaces

Linking Considerations

When building your C++ applications, you will need to ensure that the correct runtime libraries are linked. The Visual Studio IDE handles most of this automatically based on your project settings. For manual linking, you'll refer to the .lib files found in your SDK's lib directories.

Be mindful of:

  • Static vs. Dynamic Linking: Some runtime components can be statically linked into your executable, while others must be dynamically linked via DLLs.
  • Runtime Version Mismatch: Ensure that the C++ runtime DLLs (e.g., msvcp140.dll) deployed with your application are compatible with the version used during development.