November 19th, 2012, 12:03 AM
I was studying about shared and static libraries today and was looking into /usr/lib folder. I found libc.a and libc.so in /usr/lib folder.
Can anyone explain which library is exactly used and why there is both ?
November 19th, 2012, 03:00 AM
libc.a is the static C library and libc.so is the shared version of the same library.
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
November 20th, 2012, 12:59 AM
Yes. But which library will be used , whether static or shared ?
Originally Posted by Scorpions4ever
November 20th, 2012, 02:18 AM
Normally the shared ones (when they exist), but you can opt to link statically. The exact syntax will depend on the linker, but on a GNU system:
$ gcc myprog.c -o myprog # link against shared objects
$ gcc myprog.c -o myprog -static # link statically