glibc/libc/blib区别
转自:http://blog.csdn.net/yasi_xi/article/details/9899599
【glibc 和 libc】
glibc 和 libc 都是 Linux 下的 C 函数库。
libc 是 Linux 下的 ANSI C 函数库;glibc 是 Linux 下的 GUN C 函数库。
ANSI C 和 GNU C 有什么区别呢?
ANSI C 函数库是基本的 C 语言函数库,包含了 C 语言最基本的库函数。这个库可以根据头文件划分为 15 个部分,其中包括:
- <ctype.h>:包含用来测试某个特征字符的函数的函数原型,以及用来转换大小写字母的函数原型;
- <errno.h>:定义用来报告错误条件的宏;
- <float.h>:包含系统的浮点数大小限制;
- <math.h>:包含数学库函数的函数原型;
- <stddef.h>:包含执行某些计算 C 所用的常见的函数定义;
- <stdio.h>:包含标准输入输出库函数的函数原型,以及他们所用的信息;
- <stdlib.h>:包含数字转换到文本,以及文本转换到数字的函数原型,还有内存分配、随机数字以及其他实用函数的函数原型;
- <string.h>:包含字符串处理函数的函数原型;
- <time.h>:包含时间和日期操作的函数原型和类型;
- <stdarg.h>:包含函数原型和宏,用于处理未知数值和类型的函数的参数列表;
- <signal.h>:包含函数原型和宏,用于处理程序执行期间可能出现的各种条件;
- <setjmp.h>:包含可以绕过一般函数调用并返回序列的函数的原型,即非局部跳转;
- <locale.h>:包含函数原型和其他信息,使程序可以针对所运行的地区进行修改。
- 地区的表示方法可以使计算机系统处理不同的数据表达约定,如全世界的日期、时间、美元数和大数字;
- <assert.h>:包含宏和信息,用于进行诊断,帮助程序调试。
上述库函数在其各种支持 C 语言的 IDE 中都是有的。
GNU C 函数库是一种类似于第三方插件的东西。由于 Linux 是用 C 语言写的,所以 Linux 的一些操作是用 C 语言实现的,因此,GUN 组织开发了一个 C 语言的库 以便让我们更好的利用 C 语言开发基于 Linux 操作系统的程序。不过现在的不同的 Linux 的发行版本对这两个函数库有不同的处理方法,有的可能已经集成在同一个库里了。
glibc是linux下面c标准库的实现,即GNU C Library。glibc本身是GNU旗下的C标准库,后来逐渐成为了Linux的标准c库,而Linux下原来的标准c库Linux libc逐渐不再被维护。Linux下面的标准c库不仅有这一个,如uclibc、klibc,以及上面被提到的Linux libc,但是glibc无疑是用得最多的。glibc在/lib目录下的.so文件为libc.so.6。
查看当前系统的 glibc 版本的两种方法:
1.
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 ~]# |
2.
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 ~]# |
【glibc 和 glib】
错误观点:glib 前面有个 "g" ,所以认为 glib 是 GNU 的东东;同时认为 glibc 是 glib 的一个子集。
其实,glib 和 glibc 基本上没有太大联系,可能唯一的共同点就是,其都是 C 编程需要调用的库而已。
glib 是 Gtk+ 库和 Gnome 的基础。glib 可以在多个平台下使用,比如 Linux、Unix、Windows 等。glib 为许多标准的、常用的 C 语言结构提供了相应的替代物。
glib是GTK+的基础库,它由基础类型、对核心应用的支持、实用功能、数据类型和对象系统五个部分组成,可以在[http://www.gtk.org gtk网站]下载其源代码。是一个综合用途的实用的轻量级的C程序库,它提供C语言的常用的数据结构的定义、相关的处理函数,有趣而实用的宏,可移植的封装和一些运行时机能,如事件循环、线程、动态调用、对象系统等的API。GTK+是可移植的,当然glib也是可移植的,你可以在linux下,也可以在windows下使用它。使用gLib2.0(glib的2.0版本)编写的应用程序,在编译时应该在编译命令中加入pkg-config --cflags --libs glib-2.0,如:
gcc
pkg-config --cflags --libs glib-2.0hello.c -o hello
使用glib最有名的就是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.
Glibc
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 实际上是一个泛指。凡是符合实现了 C 标准规定的内容,都是一种 libc 。
glibc 是 GNU 组织对 libc 的一种实现。它是 unix/linux 的根基之一。
微软也有自己的 libc 实现,叫 msvcrt 。
嵌入式行业里还常用 uClibc ,是一个迷你版的 libc 。
【yasi】
libc, glibc在一个层次,都是C的标准实现库,是操作系统级别的基石之一。
glib是用C写的一些utilities,即C的工具库,和libc/glibc没有关系。
glibc/libc/blib区别的更多相关文章
- uclibc,eglibc,glibc之间的区别和联系【转】
本文转载自:https://www.crifan.com/relation_between_uclibc_glibc_eglibc/ [glibc,uclibc,eglibc的简介] 1.Glibc ...
- Glibc 与 libc 的区别和联系
转http://blog.163.com/dragon_sjl@126/blog/static/100473339201107101517380/ 1.gcc(gnu collect compiler ...
- uclibc,eglibc,glibc之间的区别和联系
http://bbs.chinaunix.net/thread-3762882-1-1.html 1.Glibc glibc = GNU C Library 是GNU项(GNU Project)目,所 ...
- 【整理】uclibc,eglibc,glibc之间的区别和联系
http://www.crifan.com/relation_between_uclibc_glibc_eglibc/ 1.Glibc glibc = GNU C Library 是GNU项(GNU ...
- android 调试 native 程序的方法
一.背景 首先说需求,这个需求非常常见,就是android上需要的一个功能,linux已经有开源代码而且非常稳定,希望能直接porting过去使用,这个程序是pure c 的代码,也就是说,跟andr ...
- PostgreSQL与RPM
如何查看使用PostgreSQL的RPM包安装后的文件目录及相关路径(PostgreSQLRPM的spec文件已经帮我们创建好了postgres用户及postgres组). 查看RPM文档信息:/us ...
- libc、glibc与gcc
转http://blog.163.com/dragon_sjl@126/blog/static/100473339201107101517380/ 1.gcc(gnu collect compiler ...
- [Linux]gcc/libc/glibc
转自:http://blog.csdn.net/weiwangchao_/article/details/16989713 1.gcc(gnu collect compiler)是一组编译工具的总称. ...
- C 函数库 (libc,glibc,uClibc,newlib)
glibc glibc和libc都是Linux下的C函数库,libc是Linux下的ANSI C的函数库:glibc是Linux下的GUN C的函数库:GNU C是一种ANSI C的扩展实现.ANSI ...
随机推荐
- 如何解决weblogic server启动中在IIOP后运行缓慢
WebLogic Server在Linux环境中,有时因为linux OS的安全包没有安装,导致weblogic server 在启动的时候会在长时间的停留在 <2/07/2009 08:54: ...
- postgres--流复制
配置 master 192.168.2.21 5432 slave 192.168.2.22 5432 目录 /var/lib/pgsql/10/data/ 配置主库 配置用户 psql create ...
- 支持向量机SVM 简要推导过程
SVM 是一块很大的内容,网上有写得非常精彩的博客.这篇博客目的不是详细阐述每一个理论和细节,而在于在不丢失重要推导步骤的条件下从宏观上把握 SVM 的思路. 1. 问题由来 SVM (支持向量机) ...
- Maven+SpringMVC+Mybatis整合入门Demo
1 数据库准备 (1)建立一个名为mytest的数据库 (2)创建表 CREATE TABLE `t_user` ( `USER_ID` int(11) NOT NULL AUTO_INCREMENT ...
- Oracle数据迁移至HBase操作记录
Oracle数据迁移至HBase操作记录 @(HBase) 近期需要把Oracle数据库中的十几张表T级别的数据迁移至HBase中,过程中遇到了许多苦难和疑惑,在此记录一下希望能帮到一些有同样需求的兄 ...
- mysql时间字段转换为毫秒格式
下面是转载的关于MySQL毫秒.微秒精度时间处理的两段篇章,留给自己和供大家参考~~ 一.MySQL 获得毫秒.微秒及对毫秒.微秒的处理 MySQL 较新的版本中(MySQL 6.0.5),也还没有产 ...
- js知识梳理2:对象属性的操作
1.属性的查询和设置 ①基本语法 这个简单,可以通过点(.)或方括号([])运算来获取属性的值,注意点运算符后的标识符不能是保留字,方括号内的表达式必须返回字符串或返回一个可以转换成字符串的值. va ...
- struts2异常处理
<global-results> <result name="nullException">/WEB-INF/exception/nullException ...
- Docker Container同时启动多服务 supervisor
Docker Container同时启动多服务 转载请注明来自:http://blog.csdn.net/wsscy2004 昨天踩了个天坑,我有一个基本的镜像centos6.5+ssh,是通过Doc ...
- php fpm安装curl后,nginx出现connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied)的错误
这里选择直接apt-get安装,因为比起自己编译简单多了,不需要自己配置什么 #sudo apt-get install curl libcurl3 libcurl3-dev php5-curl 安装 ...