【发布时间】:2011-08-01 13:48:52
【问题描述】:
大多数时候,当你编译一个共享库时,执行它是没有意义的,这样做没有任何用处:
$ ./libfoobarbaz.so
Segmentation fault
然而,当 glibc 被执行时,GNU 的人已经能够坚持一些输出:
$ /lib/libc.so.6
GNU C Library (Debian EGLIBC 2.11.2-10) stable release version 2.11.2, by Roland McGrath et al.
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.4.5.
Compiled on a Linux 2.6.32 system on 2011-01-23.
Available extensions:
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
Native POSIX Threads Library by Ulrich Drepper et al
BIND-8.2.3-T5B
For bug reporting instructions, please see:
<http://www.debian.org/Bugs/>.
虽然这种特殊用途对我来说似乎是老生常谈,但他们是如何实现创建一个也可作为工作可执行文件的共享库的?
【问题讨论】:
标签: c shared-libraries