
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. GLib's code was separated from
GTK, 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 whi ...
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'', ...
s, dynamic
strings and string utilities, such as a
lexical scanner, string chunks (groups of strings), dynamic
arrays, 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) binar ...
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 may refer to:
Objects
* Thread (yarn), a kind of thin yarn used for sewing
** Thread (unit of measurement), a cotton yarn measure
* Screw thread, a helical ridge on a cylindrical fastener
Arts and entertainment
* ''Thread'' (film), 2016 ...
, 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 of ...
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 supporti ...
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
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, 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 prop ...
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 User (computing), users to Human–computer interaction, interact with electronic devices through graphical icon (comp ...
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 ...
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 daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
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 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 called ''algorithms'', ''co ...
(STL) –
C++ library for data structures and algorithms
*
Boost
Boost, boosted or boosting may refer to:
Science, technology and mathematics
* Boost, positive manifold pressure in turbocharged engines
* Boost (C++ libraries), a set of free peer-reviewed portable C++ libraries
* Boost (material), a material b ...
– provides some functions for C++, such as threading primitives, similar to what GLib does for C
* QtCore – core API of the
Qt Framework
* 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 min ...
library
* The
Apache Portable Runtime and Apple
Core Foundation 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