In my program, I need to use two-linked lists. I would like to use GList, but you can’t pull the entire library for just one thing. I am interested in the glist.h and glist.c files, can I only use them and not drag other GLib files with me?
How to do this?
You can’t. GLib is not a copy-paste library, or a piecemeal one. You can only depend on the whole GLib, or nothing.
The GList implementation is not really hard to replicate outside of GLib. GList has some additional niceties, like using a slab allocator that makes freeing lists a near-constant time operation; but, of course, that comes at the cost of using GLib.
To be fair, if you’re using plain C, I’d strongly recommend depending on GLib; the linker will only ever page in the necessary symbols, and the shared library itself is fairly small, once stripped.
The fact is that I am writing a kernel for my hobby operating system and I don’t think I can compile and use glibc in it, although I would be happy to.
Is it possible to compile glibc with minimal dependencies?
What are the minimum dependencies?
GLib is not glibc, so please don’t confuse the two.
Additionally, GLib is not really meant to be used for kernel development; it’s a user space library.
I meant glib, I accidentally wrote “glibc”.
Thank you for your answer, I think I will use list from linux.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.