What does static linking against a library actually do?
Posted
by Salgar
on Stack Overflow
See other posts from Stack Overflow
or by Salgar
Published on 2010-06-03T10:21:51Z
Indexed on
2010/06/03
10:24 UTC
Read the original article
Hit count: 309
Say I had a library called libfoo which contained a class, a few static variables, possibly something with 'C' linkage, and a few other functions.
Now I have a main program which looks like this:
int main() {
return 5+5;
}
When I compile and link this, I link against libfoo.
Will this have any effect? Will my executable increase in size? If so, why? Do the static variables or their addresses get copied into my executable?
Apologies if there is a similar question to this or if I'm being particularly stupid in any way.
© Stack Overflow or respective owner