Libraries.md

July 5, 2025 ยท View on GitHub

Please send updates/corrections to predef-contribute or through pull requests on GitHub.

Standard C Libraries

Bionic libc

The following macro is defined in the <sys/cdefs.h> header file. It may be best to include it via the <sys/types.h> header file, which is required by POSIX.

TypeMacro
Idenfication__BIONIC__

GNU glibc

The following macros have to be included from the <features.h> header file.

TypeMacroDescription
Version__GNU_LIBRARY__
__GNU_LIBRARY_MINOR__
Until version 5
Version__GLIBC__
__GLIBC_MINOR__
From version 6

Notice that the <features.h> header file does not exist on all platforms, so it cannot be included without further ado. However, since it is included by other GNU glibc header files, a better way to obtain the above-mentioned macros is to include the <limits.h> header file (see e.g. paragraph 4/6 in ISO/IEC 9899:1999).

klibc

TypeMacroFormatDescription
Identification__KLIBC__Zero is a valid value
Version__KLIBC__Version
Version__KLIBC_MINOR__Revision
Version__KLIBC_PATCHLEVEL__Patch
Version__KLIBC_VERSION__0xVVRRPPPPVV = Version
RR = Revision
PPPP = Patch

uClibc

The following macros have to be included from the <features.h> header file.

TypeMacroDescription
Identification__UCLIBC__
Version__UCLIBC_MAJOR__Version
Version__UCLIBC_MINOR__Revision
Version__UCLIBC_SUBLEVEL__Patch

VMS libc

TypeMacroFormatDescription
Identification__CRTL_VER
Version__CRTL_VERVVRREPPTTVV = Version
RR = Revision
E = Edit number
PP = Patch (01 = A, ... 26 = Z)
TT = Type (22 = official)

Notice that I am not sure about the format of __CRTL_VER, but it seems to follow that of __VMS_VER.

z/OS Language Environment

TypeMacroFormatDescription
Identification__LIBREL__Host
Identification__TARGET_LIB__Target
Version__LIBREL__0xNVRRPPPPN = Product (0 = C/370, 1 = MVS, 2 = OS/390, 4 = z/OS)
V = Version
RR = Revision
PPPP = Patch

Defined for z/OS XL C/C++
Version__TARGET_LIB__As above
Example
Library__LIBREL__
OS/390 2.100x220A0000
z/OS 1.10x41010000
z/OS 1.60x41060000

z/VM Language Environment

TypeMacroFormatDescription
Version__LIBREL__
Version__TARGET_LIB__
Example
OS__TARGET_LIB____LIBREL__
z/VM 7.30x410C00000x47030000

VM/ESA Language Environment

TypeMacroFormatDescription
Version__TARGET_LIB__
Example
OS__TARGET_LIB__
VM/ESA 2.40x11050000

Z88DK C Library

TypeMacroFormatDescription
Identification__Z88DKAvailable post 2.2
Identification__Z88DK_NEWLIBnewlib builds; available post 2.2

Standard C++ Libraries

Dinkumware

TypeMacroFormatDescription
Identification_CPPLIB_VERDefined for Dinkumware 2.0 and later
Version_CPPLIB_VERVVRRVV = Version
RR = Revision
Example
DinkumwareVisual C++_CPPLIB_VER
3.06306
3.08308
4.052005405
5.032008503
5.052008 SP1505
5.202010520
5.402012540
6.102013610

GNU libstdc++

One of the standard header files must be included before any of the following macros are defined.

TypeMacroFormatDescription
Version__GLIBCPP__YYYYMMDDYYYY = Year
MM = Month
DD = Day

From GCC 3.0.0 until GCC 3.4.0
Version__GLIBCXX__YYYYMMDDYYYY = Year
MM = Month
DD = Day

From GCC 3.4.0
Example
GCC__GLIBCPP____GLIBCXX__
3.0.020010615
3.1.020020514
3.2.020020814
3.3.020030513
3.4.020040419

Intel C++ Run-Time Libraries

TypeMacro
Identification__INTEL_CXXLIB_ICC

libc++

One of the standard header files must be included before any of the following macros are defined.

TypeMacroFormatDescription
Version_LIBCPP_VERSIONVRRRV = Version
RRR = Revision
Version_LIBCPP_ABI_VERSIONVV = ABI Version

Other Libraries

Microsoft Foundation Classes

TypeMacroFormatDescription
Identification_MFC_VER
Version_MFC_VER0xVVRRVV = Version
RR = Revision
Example
MFC_MFC_VER
4.210x0421
6.00x0600
7.00x0700