LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

glib

general-purpose C utility library for GTK and GNOME

TLDR

Compile with GLib
$ gcc [program.c] $(pkg-config --cflags --libs glib-2.0) -o [program]
copy
Get GLib version
$ pkg-config --modversion glib-2.0
copy
Generate enum types
$ glib-mkenums --template [enum.h.template] [header.h] > [enum-types.h]
copy
Compile GLib resources
$ glib-compile-resources [resources.gresource.xml] --target=[resources.c]
copy

DESCRIPTION

GLib is a general-purpose utility library used by GTK and GNOME. It provides data structures, portability wrappers, event loops, threads, and many utilities for C programming.GLib is not a command but a library. Related tools include glib-compile-resources, glib-mkenums, and glib-genmarshal.

PARAMETERS

glib-mkenums --template file

Text template controlling the generated enum descriptions.
glib-genmarshal --header / --body
Generate the marshaller header or C source respectively.
glib-compile-resources --target file
Output file for the compiled resource bundle (C source or binary `.gresource`).
glib-compile-resources --generate-source / --generate-header
Generate only the C source or only the header, instead of both.
glib-compile-resources --sourcedir dir
Directory to search for referenced resource files.

KEY FEATURES

- GList/GSList: Linked lists- GHashTable: Hash tables- GString: Dynamic strings- GMainLoop: Event loop- GThread: Threading- GObject: Object system- GSettings: Configuration storage

RELATED TOOLS

$ glib-compile-resources  Compile resources
glib-compile-schemas    Compile GSettings schemas
glib-mkenums           Generate enum types
glib-genmarshal        Generate marshallers
gdbus                  D-Bus tool
gsettings              GSettings CLI
copy

INSTALL

sudo dnf install glib
copy
brew install glib
copy
nix profile install nixpkgs#glib
copy

CAVEATS

C library, not a command. Requires understanding of C and GLib conventions. Memory management follows GLib patterns. Documentation at docs.gtk.org.

HISTORY

GLib was originally part of GTK+, extracted as a separate library in 1998 to enable non-GUI programs to use its utilities. It's maintained by the GNOME project and used throughout the Linux desktop ecosystem.

SEE ALSO

RESOURCES

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid