Microsoft Open-sources Its C Standard Library (STL)
LINK - https://urlgoal.com/2t88ye
Microsoft's implementation of the C++ standard library is often referred to as the STL or Standard Template Library. Although C++ standard library is the official name of the library as defined in ISO 14882, due to the popular use of "STL" and "Standard Template Library" in search engines, we occasionally use those names to make it easier to find our documentation.
From a historical perspective, "STL" originally referred to the Standard Template Library written by Alexander Stepanov. Parts of that library were standardized in the C++ standard library. The standard library also incorporates the ISO C runtime library, parts of the Boost library, and other functionality. Sometimes "STL" is used to refer to the containers and algorithms parts of the C++ standard library adapted from Stepanov's STL. In this documentation, Standard Template Library (STL) refers to the C++ standard library as a whole.
The ISO C standard library is part of the C++ standard library. The Visual C++ libraries that implement the CRT support native code development, and both mixed native and managed code. All versions of the CRT support multi-threaded development. Most of the libraries support both static linking, to link the library directly into your code, or dynamic linking to let your code use common DLL files.
In Visual Studio 2015, the CRT was refactored into new binaries. The Universal CRT (UCRT) contains the functions and globals exported by the standard C99 CRT library. The UCRT is now a Windows component, and ships as part of Windows 10 and later versions. The static library, DLL import library, and header files for the UCRT are now found in the Windows SDK. When you install Visual C++, Visual Studio setup installs the subset of the Windows SDK required to use the UCRT. You can use the UCRT on any version of Windows supported by Visual Studio 2015 and later versions. You can redistribute it using vcredist for supported versions of Windows other than Windows 10 or later. For more information, see Redistributing Visual C++ Files.
When the UCRT was refactored, the Concurrency Runtime functions were moved intoconcrt140.dll, which was added to the C++ redistributable package. This DLL is required for C++ parallel containers and algorithms such as concurrency::parallel_for. In addition, the C++ standard library requires this DLL on Windows XP to support synchronization primitives, because Windows XP doesn't have condition variables.
This version of the CRT isn't fully conformant with the C99 standard. In versions before Visual Studio 2019 version 16.8, the header isn't supported. In all versions, the CX_LIMITED_RANGE and FP_CONTRACT pragma macros aren't supported. Certain elements such as the meaning of parameter specifiers in standard IO functions use legacy interpretations by default. You can use /Zc compiler conformance options and specify linker options to control some aspects of library conformance.
When you build a release version of your project, one of the basic C runtime libraries (libcmt.lib, msvcmrt.lib, msvcrt.lib) is linked by default, depending on the compiler option you choose (multithreaded, DLL, /clr). If you include one of the C++ standard library header files in your code, a C++ standard library will be linked automatically by Visual C++ at compile time. For example:
For binary compatibility, more than one DLL file may be specified by a single import library. Version updates may introduce dot libraries, separate DLLs that introduce new library functionality. For example, Visual Studio 2017 version 15.6 introduced msvcp140_1.dll to support more standard library functionality without breaking the Application Binary Interface (ABI) supported by msvcp140.dll. The msvcprt.lib import library included in the toolset for Visual Studio 2017 version 15.6 supports both DLLs, and the vcredist for this version installs both DLLs. Once shipped, a dot library has a fixed ABI, and will never have a dependency on a later dot library.
The C++ Standard Library: A Tutorial and Reference by renowned ISO C++ member Nicolai Josuttis is the most respected book for learning and studying the standard library. It provides comprehensive documentation of each library component, including an introduction to its purpose and design; clearly written explanations of complex concepts; the practical programming details needed for effective use; traps and pitfalls; the exact signature and definition of the most important classes and functions; and numerous examples of working code. You'll find it all here -- everything from concurrency and clocks, to the new hash-based containers and regular expressions, to high-quality guidance on how to use key language features like lambdas with it all.
We also license our technology to software development organizationswho need to standardize internally on the best library technology,and who need reliable support.We ask no additional royalty for the distribution of executables and sharedlibraries linked with our libraries, so long as the distributed productscannot be linked with object files to produce additional executables.We license by the number of developers per platform, not by the volume ofdistributed executables.
On top of the OS API functions, software vendors implement the C Runtime Library (CRT). CRT is a standardized set of header files and C functions which implement common tasks such as string operations, some math functions, basic input/output etc. Usually, the same vendor that makes the C compiler also provides the CRT implementation. The International Organization for Standardization [^] is responsible for the C language standard and its runtime library.
Theoretically, by using only standard C functions, the developer can ensure that the same code may be used to build and run a program under any platform where a decent C compiler and CRT implementation exists. However, in practice, software vendors include many useful extensions to standard library functions, which make developers' life easier but at a price of portability.
Following the Platform SDK logic, Microsoft introduced generic text mapping into its C runtime library. CRT uses an additional header file to define generic character macros: "tchar.h". In order to be compliant with the requirements of the C language standard, all non-standard names start from the underscore symbol. Also, CRT uses the shorter _T() macro for literal strings instead of the longer TEXT() macro, which is defined in "WinNT.h". CRT authors decided to advance the generic text notion even further, and as a result of this decision, now CRT distinguishes three modes for text characters:
The common approach is to develop a single code base for all platforms and restrict the usage of platform-dependent API functions and vendor-specific standard library extensions. It makes development harder; however, in the long run, all platforms benefit from new features and bug fixes.
The GNU Standard C++ Library v3 is an ongoing project to implement the ISO 14882 C++ Standard Library as described in clauses 20 through 33 and annex D (prior to the 2017 standard the library clauses started with 17). For those who want to see exactly how far the project has come, or just want the latest bleeding-edge code, the up-to-date source can be cloned via Git.
If the only functions from libstdc++.a which you need are language support functions (those listed in clause 18 of the standard, e.g., new and delete), then try linking against libsupc++.a, which is a subset of libstdc++.a. (Using gcc instead of g++ and explicitly linking in libsupc++.a via -lsupc++ for the final link step will do it). This library contains only those support routines, one per object file. But if you are using anything from the rest of the library, such as IOStreams or vectors, then you'll still need pieces from libstdc++.a.
These macros are typically used in C library headers, guarding new versions of functions from their older versions. The C++98 standard library includes the C standard library, but it requires the C90 version, which for backwards-compatibility reasons is often not the default for many vendors.
If you are using headers in${prefix}/include/g++-3, or ifthe installed library's name looks likelibstdc++-2.10.a orlibstdc++-libc6-2.10.so, thenyou are using the old libstdc++-v2 library, which is non-standard andunmaintained. Do not report problems with -v2 to the -v3mailing list.
In the past, a few people reported that the standard containers appear to leak memory when tested with memory checkers such as valgrind. Under some (non-default) configurations the library's allocators keep free memory in a pool for later reuse, rather than deallocating it with delete Although this memory is always reachable by the library and is never lost, memory debugging tools can report it as a leak. If you want to test the library for memory leaks please read Tips for memory leak hunting first.
A useful C++ ABI must also incorporate many details of the standard library implementation. For a C ABI, the layouts of a few structs (such as FILE, stat, jmpbuf, and the like) and a few macros suffice. For C++, the details include the complete set of names of functions and types used, the offsets of class members and virtual functions, and the actual definitions of all inlines. C++ exposes many more library details to the caller than C does. It makes defining a complete ABI a much bigger undertaking, and requires not just documenting library implementation details, but carefully designing those details so that future bug fixes and optimizations don't force breaking the ABI.
There are ways to help isolate library implementation details from the ABI, but they trade off against speed. Library details used in inner loops (e.g., getchar) must be exposed and frozen for all time, but many others may reasonably be kept hidden from user code, so they may later be changed. Deciding which, and implementing the decisions, must happen before you can reasonably document a candidate C++ ABI that encompasses the standard library. 2b1af7f3a8