This commit is contained in:
Miloslav Ciz 2023-08-14 21:02:33 +02:00
parent 8c19875748
commit 62ac6cc0ac
4 changed files with 12 additions and 6 deletions

View file

@ -1,10 +1,12 @@
# Library
Software library is code that's not meant to run on its own but rather be used by other programs. A library provides resources such as [functions](function.md), [macros](macro.md), [classes](class.md) or [constants](constant.md) that are normally related to solving some specific class of problems, so e.g. there are [GUI](gui.md) libraries, [audio](audio.md) libraries, [mathematical](math.md) libraries etc. Libraries exist to prevent [reinventing wheels](reinventing_wheel.md) by only ever implementing the code once so that next time we can simply reuse it (respecting the [DRY](dry.md) principle). Examples of libraries are the [standard C library](clib.md), [SDL](sdl.md) or [JQuery](jquery.md).
[Software](software.md) library is program code that's not meant to run on its own but rather to be used by other programs, i.e. it is a helpful collection of preprogrammed code that's meant to be [reused](reusability.md). A library provides resources such as [functions](function.md), [macros](macro.md), [classes](class.md) or [constants](constant.md) that are normally related to solving some specific class of problems, so e.g. there are [GUI](gui.md) libraries, [audio](audio.md) libraries, [mathematical](math.md) libraries etc. Libraries exist mostly to prevent [reinventing wheels](reinventing_wheel.md) by only ever implementing the code once so that next time we can simply reuse it (respecting the [DRY](dry.md) principle), but they also e.g. help assure others are using an already well tested code, they help to implement [modularity](modularity.md) etc. Examples of libraries are the [standard C library](clib.md), [SDL](sdl.md) or [JQuery](jquery.md). Libraries are not to be confused with [frameworks](framework.md) which are larger, more [bloated](bloat.md) environments.
If a programmer wants to use a specific library, he has to first [install](install.md) it (if it's not installed already) and then *include* it in his program with a specific command (words like `include`, `using` or `import` are commonly used). Then he is able to use the resources the library exports. Depending on the type of the library he may also need to [link](linking.md) the library code after [compilation](compiler.md) and possibly distribute the library files along with his program.
**Standard library** (stdlib) is a term that stands for the set of libraries that officially come with given [programming language](programming_language.md) -- these libraries usually offer very basic functionality (such as [I/O](io.md) and basic [math](math.md)) and are required to always be present on every system.
You will often hear a library as a certain [API](api.md) -- this is the interface of the library consisting of the elements via which programmer uses the library, mostly the [functions](function.md) the library offers. If a programmer wants to know the library API, he wants to know the names of the functions, what [parameters](parameter.md) they take etc. Sometimes there may be multiple libraries with the same API but different internal implementations, this is nice because these libraries can be easily [drop-in-replaced](drop_in.md).
If a programmer wants to use a specific library, he usually has to first somehow [install](install.md) it (if it's not installed already, usually a library is some kind of software [package](package.md)) and then *include* it in his program with a specific command (words like `include`, `using` or `import` are commonly used). Then he is able to use the resources of the library. Depending on the type of the library he may also need to [link](linking.md) the library code after [compilation](compiler.md) and possibly distribute the library files along with his program.
You will often hear that a library has certain [API](api.md) -- this is the interface of the library consisting of the elements via which programmer uses the library, mostly the [functions](function.md) the library offers. API is what the programmer interacts with; the rest is library internals (its [implementation](implementation.md)) that's usually supposed to not be touched and stay a bit hidden (see [encapsulation](encapsulation.md)). If a programmer wants to know the library API, he wants to know the names of the functions, what [parameters](parameter.md) they take etc. Sometimes there may be multiple libraries with the same API but different internal implementations, this is nice because these libraries can be easily [drop-in-replaced](drop_in.md).
In a specific [programming language](programming_language.md) it IS generally possible to use a library written in a different language, though it may be more difficult to achieve.
@ -17,6 +19,8 @@ Many times a library can have both static and dynamic version available, or the
## C Libraries
TODO: example
## LRS Libraries
TODO