Why use GLib functions?

In general, GLib’s purpose is a utility and portability library. Those in itself are reasons to consider using it. The specific functions you mention all offer something extra on top of their C standard library variants: g_strdup_printf is like sprintf, but actually allocates the buffer for you and saves you the guesswork of how large … Read more

What’s the significance of a C function declaration in parentheses apparently forever calling itself?

The function name g_atomic_int_compare_and_exchange_full is in parentheses. What’s the significance of this? Putting a function name in brackets avoids any macro expansion in case there is a function like macro with the same name. That means, g_atomic_int_compare_and_exchange_full(…) will use the macro while (g_atomic_int_compare_and_exchange_full)(…) will use the function. Why is this used? You cannot assign a … Read more

glibc, glib and gnulib

glibc is a core C runtime library. It provides things like printf(3) and fopen(3). glib is an object-based event loop and utility library written in C. gnulib is a library that provides an adapter from the POSIX API to the native API. All three are used for completely different tasks.

Sublime Text on Ubuntu 14.04 – Keeps attempting to remove it

This page in Ubuntu’s bug tracker describes this particular situation. Apparently this is a known bug with 14.04, possibly because of a regression with GLib, or a mismatch between GLib and GTK (so says one of the commenters). Nothing is trying to remove Sublime, it’s just an error in a programming library. If nothing is … Read more

What exactly are GLib and GObject?

GLib and GOBject are 2 separate C libraries from which the GTK+ GUI toolkit is built (among other things). Since C is a lower-level language, GLib provides a lot of basic functionality like those utilities similar to what is built-in with Python (file input/output, string manipulation, memory management, threading, etc.). Since C is not an … Read more

Why can’t I build a “hello world” for glib?

glib tends to hide itself… Your include statement doesn’t work because GCC doesn’t automatically search subdirectories, and so cannot see the glib.h in glib-1.2 or glib-2.0. Read the Compiling GLib Applications page in the GLIB manuals… you use commands like pkg-config –cflags glib-2.0 to get the right flags for GCC. The canonical way to do … Read more

tech