There are many common libraries under Linux,
libc, glibc; glib, gdk, gtk, too many. But these libraries are hierarchical.
libc is the ANSI C library under Linux ; glibc is the GUN C library under Linux.
glibc is the implementation of the C standard library under Linux, namely the GNU C Library. glibc itself is the C standard library of GNU, and later gradually became the standard c library of Linux, and the original standard c library Linux libc under Linux is gradually no longer maintained . The standard c libraries under Linux not only have this one, such as uclibc, klibc, and the Linux libc mentioned above, but glibc is undoubtedly the most used . The .so file of glibc in the / lib directory is libc.so.6.
Notice: glibc and glib are different. In fact, glib and glibc are basically not related. The only thing they may have in common is that they are all libraries that C programming needs to call. glib is the foundation of the Gtk + library and Gnome. glib can be used on multiple platforms, such as Linux, Unix, Windows, etc. glib provides corresponding replacements for many standard and commonly used C language constructs.
simply put:
xlib: The X Library is the lowest-level API of the X Window program. If compared with Windows, Xlib is the same as the Windows APIs (or Windows SDK). It is the programming interface that is closest to X Server. It only provides the most Basic drawing and handling of message events.
glib: a utility library for C under Linux , including portability and some utility functions, as well as some container classes, such as: linked lists, variable arrays, variable-length strings, hash tables, cache, an event loop, and others Useful structure. glib is some utilities written in C, that is, C tool library, and has nothing to do with libc / glibc.
gdk: simply wraps the Xlib function library, and it is only used when we do special painting or set special properties of the window.
gtk: It is part of the GTK + library. This library provides basic toolkits and widgets to create GUI applications. Most GUIs are written directly in GTK. GTK also provides a powerful object system for the Gnome library.
Below the dividing line are reproduced:
1. Address: http://socol.iteye.com/blog/579718
GNOME (GNU Network Object Model Environment) is a graphical interface library based on GTK. Like KDE, GNOME is also aimed at creating a complete and friendly graphical environment and provides GNOME related software.
The Gnome library is at the highest level and includes help routines, classes and special widgets, and provides an infrastructure for the application.
The second layer is GTK, which is part of the GTK + library. This library provides basic toolkits and widgets to create GUI applications. Most GUIs are written directly in GTK. GTK also provides a powerful object system for the Gnome library.
The next layer is GDK, which simply wraps the X function library. It will be used only when we make special paintings or set special properties of the window. The
bottom layer is Glib, which is a C Utility library, including portability and some utility functions, as well as some container classes, such as: linked lists, variable arrays, variable-length strings, hash tables, cache, an event loop, and other useful structures.
2. Address: http://blog.csdn.net/yasi_xi/article/details/9899599
[Glibc and libc] Both glibc and libc are C function libraries under Linux. libc is the ANSI C library under Linux; glibc is the GUN C library under Linux. What is the difference between ANSI C and GNU C?
The ANSI C function library is a basic C language function library, which contains the most basic C language library functions. This library can be divided into 15 parts according to header files, including:
glibc is the implementation of the C standard library under Linux, namely the GNU C Library. glibc itself is the C standard library of GNU, and later gradually became the standard c library of Linux, and the original standard c library Linux libc under Linux is gradually no longer maintained . The standard c libraries under Linux not only have this one, such as uclibc, klibc, and the Linux libc mentioned above, but glibc is undoubtedly the most used . The .so file of glibc in the / lib directory is libc.so.6.
01 |
[root@Betty ~] # /lib/libc.so.6 |
02 |
GNU C Library stable release version 2.5, by Roland McGrath et al. |
03 |
Copyright (C) 2006 Free Software Foundation, Inc. |
04 |
This is free software; see the source for copying conditions. |
05 |
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A |
06 |
PARTICULAR PURPOSE. |
07 |
Compiled by GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-52). |
08 |
Compiled on a Linux 2.6.9 system on 2013-01-08. |
09 |
Available extensions: |
10 |
The C stubs add-on version 2.1.2. |
11 |
crypt add-on version 2.1 by Michael Glad and others |
12 |
GNU Libidn by Simon Josefsson |
13 |
GNU libio by Per Bothner |
14 |
NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk |
15 |
Native POSIX Threads Library by Ulrich Drepper et al |
16 |
BIND-8.2.3-T5B |
17 |
RT using linux kernel aio |
18 |
Thread- local storage support included. |
19 |
For bug reporting instructions, please see: |
20 |
<http://www.gnu.org/software/libc/bugs.html>. |
21 |
[root@Betty ~] # |
1 |
[root@Betty ~] # ldd --version |
2 |
ldd (GNU libc) 2.5 |
3 |
Copyright (C) 2006 Free Software Foundation, Inc. |
4 |
This is free software; see the source for copying conditions. There is NO |
5 |
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
6 |
Written by Roland McGrath and Ulrich Drepper. |
7 |
[root@Betty ~] # |
glib is the basic library of GTK + . It consists of five parts: basic types, support for core applications, practical functions, data types and object systems . You can download the source code at [ http://www.gtk.org gtk website] . It is a comprehensive and practical lightweight C library , which provides the definition of commonly used data structures in C language, related processing functions, interesting and practical macros, portable packaging and some runtime functions, such as events API loop, threads, dynamic invocation, the target system . GTK + is portable, and of course glib is also portable. You can use it under linux or under windows. Applications written using gLib2.0 (version 2.0 of glib), at should be added to the compile command during compilationpkg-config --cflags --libs glib-2.0
, such as:
gcc
pkg-config --cflags --libs glib-2.0
hello.c -o hello
The most famous use of glib is GNOME.
Glib
GLib is a general-purpose utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a main loop abstraction, and so on. It works on many UNIX-like platforms, Windows, OS / 2 and BeOS. GLib is released under the GNU Library General Public License (GNU LGPL).
The general policy of GLib is that all functions are invisibly threadsafe with the exception of data structure manipulation functions, where, if you have two threads manipulating the same data structure, they must use a lock to synchronize their operation.
GLib is the low-level core library that forms the basis for projects such as GTK + and GNOME. It provides data structure handling for C, portability wrappers, and interfaces for such runtime functionality as an event loop, threads, dynamic loading, and an object system.
Overview:
Any Unix-like operating system needs a C library: the library which defines the `` system calls '' and other basic facilities such as open, malloc, printf, exit ...
The GNU C Library is used as the C library in the GNU systems and most systems with the Linux kernel.
Project Goals:
The GNU C Library is primarily designed to be a portable and high performance C library. It follows all relevant standards including ISO C11 and POSIX.1-2008. It is also internationalized and has one of the most complete internationalization interfaces known.
History:
The history of Unix and various standards determine much of the interface of the C library. In general the GNU C Library supports the ISO C and POSIX standards. We also try to support the features of popular Unix variants (including BSD and System V ) when those do not conflict with the standards. Different compatibility modes (selectable when you compile an application) allow the peaceful coexistence of compatibility support for different varieties of Unix.
libc is actually a general term. Any content that meets the requirements of the C standard is a libc.
glibc is an implementation of libc by the GNU organization. It is one of the foundations of unix / linux.
Microsoft also has its own libc implementation, called msvcrt.
UClibc is also commonly used in the embedded industry, it is a mini version of libc.
Libc and glibc are at the same level. They are all C standard implementation libraries and one of the cornerstones of the operating system level.
glib is some utilities written in C, that is, C tool library, and libc / glibc has nothing to do.
This article is contributed by Anonymous and text available under CC-SA-4.0