There are generally three types of libraries in terms of how executables access them:
- static;
- dynamic, automatically loaded; and
- dynamic, manually loaded.
Static libraries tend to be linked in to the executable at build time, usually by a linker. The executable is therefore "stuck" with those libraries forever.
Dynamic libraries are "late-binding", they tend to be linked to your executable when the code is running, or about to run. That's what run-time means, something done at the time of running, contrast that with compile-time static linking).
The automatically loading one is handled by the operating system (loader) without you having to take any specific action in your code. At build time, you've specified what libraries are needed when the executable loads but the actual linking of those libraries to your executable happens later.
That means you can replace the libraries to affect how your executable works, without relinking the executable (unlike static linking).
The manual dynamic libraries are ones where you explicitly load the library from your code, with calls such as dlopen
(to open a library) and dlsym
(to get the address of a symbol within that library).
You may also want to take a look at this answer, on the static/dynamic distinction.
That covers the types of libraries you're likely to encounter but, in terms of the link you've provided in a comment, it appears the "runtime library" being referred to here is simply a library that provides some of the language features.
For example, the C runtime library is a library containing things like fopen()
for opening files or strcpy()
for copying strings. While the compiler understands the core language (if
, while
and so on, including how to call functions), the non-core-language features are provided as libraries containing functions that can be called.
In that sense, asking the difference between dynamic and runtime libraries is incongruous, as they refer to different concepts. The runtime library could be provided as static or dynamic.