Kris Warkentin <email@example.com> wrote in message
“zhz_zhang” <> firstname.lastname@example.org> > wrote in message
news:aqvmdm$g5o$> email@example.com> …
2.When I use c library (libc.so) function such as printf(…).We don’t
or dlclose() function to load the library to memory.But we can use the
at once.Why? So I think that The libc.so seems not Statically linked
lib,I think that it
seems not Dynamically linked lib either.
So what style-lib the libc.so is?
libc of cause is Dynamic linked lib. The fact you didn’t call dlopen() just
loaded it for you (before your main() get called).
When you linking your program, you (or the linker) already decided it will
Linked libc.so, the information is stored in your binary, and when you
asking to run
your program, somebody (the loader) deicded to load that for you.
objdump -x on your binary, you would see “NEEDED” lines, which telling
THIS binary needed before it’s main() get called.
3.Where does the Dynamically linked library used in normally?
The most common usage of shared libs is just as you describe with libc.
Code sharing. Since almost every application need libc, (yeah, they may not
the whole libc but …) it make sense to have one copy of libc exist in
call into it, then every application have their own copy of (partial) libc.
Dynamic processing (plug in): You wait until seeing the incomming data, and
it is, let’s say, a mpeg2 stream, then you dlopen() a mpeg2-codec.so, pass