Saturday, 27 July 2013

An introduction to Library files

What is a library ?

In simple terms - a library is obtained by grouping multiple compiled object code files . Libraries are also know as shared components or archive libraries .

When to create/use library?

A library can be created when ever you have some functions or any piece of code that will be used by many applications .

Instead of rewriting that piece of code in every application repeatedly , you can just include the library in a single statement .

Seems to be useful??? read further

Types of libraries

In linux there are 2 c/c++ library types

1 } Static Library - These are files that have the .a extension ( .lib in windows ) . The static library is linked into the executable during the link time . All the codes related to the library will be in this file . A program that makes use of the static library file will take all the codes that uses from the static library and will make it as a part of the program itself.

2 } Shared/Dynamic Library - These are files that have the .so extension ( .dll in windows ) .This can be used in 2 ways .

             a } Dynamically linked at run time . The shared objects will not included  to the executable component but it will be tied to the execution .

             b } Can be loaded and unloaded during execution using the dynamic linking loader system functions .


    
               

No comments:

Post a Comment