Tweaks page updated

Adam Trilling agt10 at columbia.edu
Sun Jul 28 22:13:34 PDT 2002


On Sun, 28 Jul 2002, Charles Lacour wrote:

> In the interests of writing such a script, how do you tell a static
> library from a dynamic one?
>
> For that matter, what exactly _is_ a static library? I understand static
> programs (which don't use libraries) and dynamic programs (which do), but
> static vs dynamic for the libraries themselves doesn't entirely make sense.
>
> (I realize this is a bit off-topic, so if you want, send the answer to
> either lfsdev at clacour.com or clacour at clacour.com. I suspect there's more
> than a few lurkers that could use the answer also, though.)

How to tell the difference:  static library filenames end in .a or .la.
Dynamic library filenames end in .so (which is a symlink to
libwhatever.so.x, which is a symlink to libwhatever.so.x.x.x).

The real difference:  when a program links against a static library, the
code of the library is actually copied into the executable.  When a
program links against a dynamic library, the library is loaded into memory
when the program runs.  Therefore many programs can use the same copy of a
library.  With something like glibc, where almost every program on your
system links against it, this saves a tremendous amount of space.

The added cost is complexity.  But it's a complexity you don't see much
unless you hack gcc or glibc or the kernel.

For further reading, check out the Program Library HOWTO on tldp.
Interesting reading, and very informative.

http://www.tldp.org/HOWTO/Program-Library-HOWTO/index.html


Adam Trilling
agt10 at columbia.edu


char m[9999],*n[99],*r=m,*p=m+5000,**s=n,d,c;main(){for(read(0,r,4000);c=*r;
r++)c-']'||(d>1||(r=*p?*s:(--s,r)),!d||d--),c-'['||d++||(*++s=r),d||(*p+=c==
'+',*p-=c=='-',p+=c=='>',p-=c=='<',c-'.'||write(2,p,1),c-','||read(2,p,1));}

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-dev' in the subject header of the message



More information about the lfs-dev mailing list