If you are new to Linux, you are most likely to encounter libraries, which can be either static or shared.
But what are libraries?
When someone writes a program, object codes are used inside these programs. Sometimes, these object codes are repeatedly used, hence it would be more practical to create an archive of these common functions than write the same function again and again. The archives containing these common functions are called libraries, therefore, libraries are object codes grouped together into one entity. There are two types of libraries, it can either be static or shared.
Static libraries are libraries that is, well, statically linked and copied into the application. Basically, it means that the object codes are available only to the application that calls these codes, therefore if you have ten programs running, you will need a copy of objects for each program as static libraries are not shared to another program.
Shared libraries are object codes that are shared by and common among many programs. This means that a shared library can be referenced by any program that can access the library.
Advantages and Disadvantages
Static libraries require that each program has a copy of the objects, therefore it does not have dependency problems with shared libraries. A shared library can have this issue, for example, if someone has updated the library, it can break another program that uses the same library. Hence, it is important to make sure that the shared library remains compatible to all the programs that uses it.
Shared libraries minimizes the size of an application for it does not have to come with the common libraries, an advantage over static linking where all the libraries it needs are included in the application.
Shared libraries can also utilize a kind of linking called dynamic linking. Dynamic linking basically means that the libraries are called during the application loads or executes. These types of libraries are called dynamic shared objects or DSO, these libraries are linked by a linker, ld.so in Linux systems.
1 Comment to “What are Libraries in Linux?”
Subscribe to Email Feeds
- Vim: How to Copy Multiple Lines
- Required Packages for Oracle 11gR2 on Red Hat Enterprise Linux 6
- How Replace Space with Newline in Vim
- How to Add or Remove Library Path in RHEL | PinoyTux Weblog on What are Libraries in Linux?
- 博文：《RHEL4 安装yum》 - 苗乡小鱼的博客 on Howto: Install yum On RHEL 4
- Hiding Files Inside An Image in Linux | SACHIN JINDAL'S BLOG on Hide Files Inside An Image File
- Falko on Howto: Install yum On RHEL 4
- Akira on Cebu Pacific Airlines is Evil!