Runtime library
Access to a program's runtime environment
title: "Runtime library" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["computer-libraries", "runtime-systems"] description: "Access to a program's runtime environment" topic_path: "general/computer-libraries" source: "https://en.wikipedia.org/wiki/Runtime_library" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0
::summary Access to a program's runtime environment ::
A runtime library is a library that provides access to the runtime environment that is available to a computer program tailored to the host platform. A runtime environment implements the execution model as required for a development environment such as a particular programming language. A runtime library may provide basic program facilities such as for memory management and exception handling.{{cite web | url = https://gcc.gnu.org/onlinedocs/gccint/Libgcc.html | work = Internals of the GNU compilers |title=4. The GCC low-level runtime library | access-date = 2013-12-30 | publisher = GNU
A runtime library is an artifact of the design of the toolchain used to build the program not inherently required by the host operating system or the programming language in which the program is written. The toolset is designed to abstract aspects of the host platform often to simplify tool development. The toolchain builds a program to depend on a runtime library and to use it while the program is running at program run-time.
The runtime library may directly implement runtime behavior, but often it is a thin wrapper on top of operating system facilities. For example, some language features that can be performed only (or are more efficient or accurate) at runtime are implemented in the runtime environment and may be invoked via the runtime library API, e.g. some logic errors, array bounds checking, dynamic type checking, exception handling, and possibly debugging functionality. For this reason, some programming bugs are not discovered until the program is tested in a "live" environment with real data, despite sophisticated compile-time checking and testing performed during development.
As another example, a runtime library may contain code of built-in low-level operations too complicated for their inlining during compilation, such as implementations of arithmetic operations not directly supported by the targeted CPU, or various miscellaneous compiler-specific operations and directives.{{cite web | url = https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#Other-Builtins | title = Other Built-in Functions Provided by GCC | work = GCC Introduction | access-date = 2013-12-30 | publisher = GNU
The runtime library is often confused with the language standard library which implements functionality as defined by a language. A standard library could be implemented in a platform-specific way or it could leverage a runtime library to be platform independent. For example, the C standard library is relatively large while the platform-specific runtime library (commonly called [crt0](crt0)) is relatively small which eases supporting multiple platforms.{{cite web
| url = http://www.embecosm.com/appnotes/ean9/html/ch05s02.html
| title = The C Runtime Initialization, crt0.o
| date = July 2010
| access-date = 2013-12-30
| publisher = Embecosm
|work= Howto: Porting newlib
|first1=Jeremy
|last1=Bennett
Examples
References
::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::