![GTK+ software architecture](https://upload.wikimedia.org/wikipedia/commons/a/ab/GTK%2B_software_architecture.svg)
GLib is a bundle of three (formerly five) low-level system
libraries
A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vir ...
written in
C and developed mainly by
GNOME
A gnome is a mythological creature and diminutive spirit in Renaissance magic and alchemy, first introduced by Paracelsus in the 16th century and later adopted by more recent authors including those of modern fantasy literature. Its characte ...
. GLib's code was separated from
GTK
GTK (formerly GIMP ToolKit and GTK+) is a free and open-source cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both free and propriet ...
, so it can be used by software other than GNOME and has been developed in parallel ever since.
Features
GLib provides advanced data structures, such as memory chunks, doubly and singly
linked list
In computer science, a linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes whic ...
s,
hash table
In computing, a hash table, also known as hash map, is a data structure that implements an associative array or dictionary. It is an abstract data type that maps keys to values. A hash table uses a hash function to compute an ''index'', als ...
s, dynamic
strings
String or strings may refer to:
*String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects
Arts, entertainment, and media Films
* ''Strings'' (1991 film), a Canadian anim ...
and string utilities, such as a
lexical
Lexical may refer to:
Linguistics
* Lexical corpus or lexis, a complete set of all words in a language
* Lexical item, a basic unit of lexicographical classification
* Lexicon, the vocabulary of a person, language, or branch of knowledge
* Lex ...
scanner, string chunks (groups of strings), dynamic
arrays
An array is a systematic arrangement of similar objects, usually in rows and columns.
Things called an array include:
{{TOC right
Music
* In twelve-tone and serial composition, the presentation of simultaneous twelve-tone sets such that the ...
, balanced
binary tree
In computer science, a binary tree is a k-ary k = 2 tree data structure in which each node has at most two children, which are referred to as the ' and the '. A recursive definition using just set theory notions is that a (non-empty) binary t ...
s,
N-ary trees, quarks (a two-way association of a string and a unique integer identifier), keyed data lists, relations, and
tuple
In mathematics, a tuple is a finite ordered list (sequence) of elements. An -tuple is a sequence (or ordered list) of elements, where is a non-negative integer. There is only one 0-tuple, referred to as ''the empty tuple''. An -tuple is defi ...
s.
Caches provide memory management.
GLib implements functions that provide
threads, thread programming and related facilities such as primitive variable access,
mutexes, asynchronous
queue __NOTOC__
Queue () may refer to:
* Queue area, or queue, a line or area where people wait for goods or services
Arts, entertainment, and media
*''ACM Queue'', a computer magazine
* ''The Queue'' (Sorokin novel), a 1983 novel by Russian author ...
s, secure
memory pool
Memory pools, also called fixed-size blocks allocation, is the use of pools for memory management that allows dynamic memory allocation comparable to malloc or C++'s operator new. As those implementations suffer from fragmentation because ...
s,
message passing
In computer science, message passing is a technique for invoking behavior (i.e., running a program) on a computer. The invoking program sends a message to a process (which may be an actor or object) and relies on that process and its supporting i ...
and logging,
hook function
In computer programming, the term hooking covers a range of techniques used to alter or augment the behaviour of an operating system, of applications, or of other software components by intercepting function calls or messages or events passed ...
s (callback registering) and
timer
A timer is a specialized type of clock used for measuring specific time intervals.
Timers can be categorized into two main types.
The word "timer" is usually reserved for devices that counts down from a specified time interval, while devices th ...
s. GLib also includes message passing facilities such as
byte order conversion and I/O channels.
Some other features of GLib include:
* standard
macros
* warnings and assertions
* dynamic loading of
modules
Broadly speaking, modularity is the degree to which a system's components may be separated and recombined, often with the benefit of flexibility and variety in use. The concept of modularity is used primarily to reduce complexity by breaking a sy ...
Components
The GLib package consisted of five libraries, but they were all merged into one library, since then named simply ''GLib'', and are no longer sustained as standalone libraries. The original libraries were:
*
GObject
The GLib Object System, or GObject, is a free software library providing a portable object system and transparent cross-language interoperability. GObject is designed for use both directly in C programs to provide object-oriented C-based APIs ...
, an object system including the type system GType
* GLib
* GModule
* GThread
*
GIO
Of these, three continue to reside in distinct subdirectories of the source tree, and so can be thought of as discrete components: GLib, GObject, and GIO. These can be thought of as a software stack: GObject relies on GLib, and GIO provides higher-level functionality that uses both.
History
GLib began as part of the
GTK+
GTK (formerly GIMP ToolKit and GTK+) is a free and open-source cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both free and proprie ...
project, now named GTK. However, before releasing GTK+ version 2, the project's developers decided to separate code from GTK+ that was not for
graphical user interface
The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
s (GUIs), thus creating GLib as a separate software bundle. GLib was released as a separate library so other developers, those not using the GUI-related parts of GTK+, could use the non-GUI parts of the library without the overhead of depending on the full GUI library.
Since GLib is a
cross-platform
In computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several computing platforms. Some cross-platform software r ...
library, applications using it to interface with the
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs.
Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
are usually portable across different operating systems without major changes.
Releases
Glib is undergoing active development. For a current overview se
https://gitlab.gnome.org/GNOME/glib/-/blob/main/NEWS The table below documents major patch notes from 1998 to 2022.
Similar projects
Other libraries provide low-level functions and implementations of data structures, including:
*
Standard Template Library
The Standard Template Library (STL) is a Library (computer science), software library originally designed by Alexander Stepanov for the C++ programming language that influenced many parts of the C++ Standard Library. It provides four components ...
(STL) –
C++
C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
library for data structures and algorithms
*
Boost – provides some functions for C++, such as threading primitives, similar to what GLib does for C
* QtCore – core API of the
Qt Framework
Qt (pronounced "cute") is cross-platform software for creating graphical user interfaces as well as cross-platform applications that run on various software and hardware platforms such as Linux, Windows, macOS, Android or embedded systems wit ...
* wxBase – non-GUI functions of the
wxWidgets
wxWidgets (formerly wxWindows) is a widget toolkit and tools library for creating graphical user interfaces (GUIs) for cross-platform applications. wxWidgets enables a program's GUI code to compile and run on several computer platforms with mini ...
library
* The
Apache Portable Runtime
The Apache Portable Runtime (APR) is a supporting library for the Apache web server. It provides a set of APIs that map to the underlying operating system (OS). Where the OS does not support a particular function, APR will provide an emulation. ...
and Apple
Core Foundation
Core Foundation (also called CF) is a C application programming interface (API) written by Apple for its operating systems, and is a mix of low-level routines and wrapper functions. Most Core Foundation routines follow a certain naming conventi ...
have a large functional overlap with GLib, and provide many similar OS-portable threading, network and data structure implementations in C.
References
External links
*
GLib API documentationGLib Git Source Tree
{{DEFAULTSORT:Glib
C (programming language) libraries
Free computer libraries
Free software programmed in C
GNOME libraries
GTK
Software using the LGPL license