Ok, so, is GLib universal? Is developed like for Linux world or for GNOME world? Is it dedicated for GNOME? Is GLib GNOMEâs like Libadwaita and GDM are or is it for Linux like systemd is?
Do you understand what I mean? Sure, I can use it, but if itâs dedicated for GNOME, it might turn against me. If itâs made for all in Linux, then I can trust that my usecase will be taken into account as well.
There is no guarantee, at any point, that any free and open source software project will take into account your specific use case.
GLib provides you with an API, and a guarantee about API stability; it has requirements on the toolchain that you can use with it. Thatâs all you can rely on.
As far as you can be concerned: the majority of people contributing to GLib are GNOME developers; the GNOME project does not âownâ anything, outside of the trademarks of the GNOME project. The people who maintain and contribute to GLib decide the technical direction of the project.
It was just an example, but do you understand that there is a difference between e.g. GDM and systemd? The former is primarily for Gnome and the latter for Linux in general.
Good point!
I know that and thatâs ok. This is getting a bit semantic, but is GLib GNOMEâs? Think about originally RPM stood Red Hat Package Manager but now RPM Package Manager and 389 Directory Server was originally called Fedora Directory Server. Developers are still mostly the same, but the projects are now independent.
GLib is not meant to be used only for GNOME apps. You can use it as a helper library or a better libc for other projects as well. Itâs used by flatpak, pkg-config, gstreamer, etc.
Iâm not sure this is a great example. GDM and systemd perform different functions, and there are plenty of people who would say that systemd is opinionated, not built for Linux in general, and doesnât fulfil their use case.
GLib is a platform library which is used by many hundreds of projects outside of GNOME. It is maintained with that in mind. As Emmanuele says, it has strict and documented API guarantees, so itâs not going to pull the rug out from underneath you.
As maintainers, we take peopleâs feature requests into account on a case-by-case basis, so thereâs no guarantee that we will, or wonât, implement things for your use case. It generally depends on how useful the functionality would be for other people, how maintainable it is, and whoâs going to spend the time to write the code.
If GLib is for only GNOME, I prefer to use other universal, common libraries. I love GNOME, but I think a general purpose library like GLib should be generic and not DE specific.
Itâs about the same as that the reason many projects didnât want to use 389 Directory Server under its old Fedora Directory Server name.
This is exactly what Iâve been trying to figure out. GLib suddenly looks a dedicated library for GNOME by GNOME Project.
To avoid ambiguity, could someone answer these:
Is GLib GNOMEâs library? Is it for GNOME and GNOME âplatformâ, for GTK and GTK world or for whole Linux?
GTK is developed by GTK Team and in principle separate, independent project, although technically GNOME Foundation owns the trademark.
So, is GLib developed by GLib Team etc or is it GNOMEâs project?
If I develop a CLI tool which normally not used with GNOME or related software (the tool is for minimal server and container enviroments), is it recommended to use GLib? Or is GLib primarily for only GNOME and related stuff?
All these questions have now been answered multiple times already, but OK:
GLib is for use inside and outside of GNOME. Of the options you provide, âfor whole Linuxâ is the closest.
GLib is developed by the GLib team, most of whom also work on GNOME modules.
If you are writing a CLI tool in C, I would recommend you use GLib. It provides a lot of utility functions which you would otherwise have to write yourself, and smooths out a lot of differences between OS platforms.
Since GLib is not project of the GNOME Project, we should update to there that the developer is GLib Team. Also the link is now to wiki.gnome.org/Projects/GLib.
Wikipedia also says:
GLib is a bundle of three (formerly five) low-level system libraries 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.
This IMO gives a bit of a false impression. What about something like âGLib is a general purpose library for C by GLib Team. Originaly GLibâs code was separated from GTK. Nowdays GLib is used by many popular software like Flatpak, GTK and GNOME.â?
Can you please explain where you are getting this impression? I would recommend to study closely the code that is in GLib. It is just a collection of common utilities: data structures, thread abstraction, I/O abstractions, unicode handling, etc. None of that has anything to do with GNOME nor was it invented by GNOME. In fact most every desktop and server application these days will probably use those things. And IMO GLib is useful if you are writing any high-level C application because it supplies many missing things that are not in the C standard library, i.e. things that you would find in newer languages such as C++ or Python but are still missing from standard C.
You can get this information pretty easily from your distro, for example in Fedora the command to list all packages using glib is this:
dnf repoquery --all --whatrequires glib2
AFAIK systemd, pipewire and wayland do not use glib because they have one restriction: they are supported on embedded platforms so they need to handle out-of-memory conditions. By design GLib does not fail gracefully in out-of-memory conditions so that is a rare situation where I would say do not use GLib. But unless you are already targeting a specific embedded platform with known strict memory limitations, you will probably not need to worry about that.