Runtime library
This article needs additional citations for verification. (December 2013) |
Program execution |
---|
General concepts |
Types of code |
Compilation strategies |
Notable runtimes |
|
Notable compilers & toolchains |
|
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.[1] A runtime library may provide basic program facilities such as for memory management and exception handling.[2]
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.[2][3]
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
) is relatively small which eases supporting mutliple platforms.[1]
Examples
[edit]See also
[edit]References
[edit]- ^ a b Bennett, Jeremy (July 2010). "The C Runtime Initialization, crt0.o". Howto: Porting newlib. Embecosm. Retrieved 2013-12-30.
- ^ a b "4. The GCC low-level runtime library". Internals of the GNU compilers. GNU. Retrieved 2013-12-30.
- ^ "Other Built-in Functions Provided by GCC". GCC Introduction. GNU. Retrieved 2013-12-30.