Heapcoding

What is Library in Programming – Well Explained

Published October 2, 2020

what is library in programming

what is library in programming

What is Library in Programming? Library is a collection of functions which you can add to your application and call them according to your need, just like the other functions you call in your application. You can not only store the functions in the library, but also you can store the objects too. But mostly the majority of libraries contain only the functions.

Implementation of Library

The actual implementation of a library is language or system specific. Let’s say if you are building a C/C++ program on Windows Operating System. You should have at least these things.

Static  Library (Lib)

Static library is compiled to object code by a compiler. Then these objects are merged together by a linker or librarian tool. That usually comes with the compiler suite.

Dynamic Linked Library (DLL)

This type of library is specifically for Windows Operating System. When we load any application, the OS automatically links the library to the application. The process of linking a library to an application is the same as the normal link process of an executable file. But only the difference is that the final executable file is created when the OS loads the application, not when it is being built.

DLL or any other library files are opened by the application and functions are called through function pointers. The plugin is a great example of the library. Many applications use the plugins, these plugins are basically libraries.

Can We Open/Modify the Library?

Can We Open/Modify the Library?

Yes it is possible to open or modify the library with a librarian tool. If you want to use a library or you want to use the objects from it is equivalent. But the most convenient method is to use only those files or objects which you want to use instead of using those hundreds of objects through which the library is made.

Method of opening or modifying the libraries is different according to the platform and languages. Let’s say if you want to modify a PHP programming language library you can simply open the PHP file of the library and edit it and save it.

Best Practices to using/modifying of library

But my recommendation is not to modify or edit the library because whenever a new update of the library comes then the changes you made were lost or deleted due to the old files and will be replaced by the new files.

If it is compulsory to make changes in library code then I am very sure that the good libraries provide you the feature to override their core functionality via separate files and just need to extend your files with those library files which you want to manipulate.

Summary

The libraries are great time saving coding solutions. You must use libraries in your programs if you have less time or want to provide progressive work to your boss in less time.

You may also like: