Static library and Dynamic library C++
Agenda 1) Static Library vs Dynamic Library 2) Create and use static library 3) Create and use Dynamic library A library is a collection of pre-compiled code that can be re-used by programs. There are 2 types of libraries: static library and dynamic library. 1) Static Library vs Dynamic Library A static library (or archive) contains code that is linked to users’ programs at compile time. The executable file generated keeps its own copy of the library code. A dynamic library (or shared library) contains code designed to be shared by multiple programs. The content in the library is loaded to memory at runtime. Each executable does not maintain its replication of the library. 2) Create and use static library Linux -> .a (archive file) Windows -> .lib file [Create a static library]: The process involves 2 steps. STEP-1: Generate the object file(s). E.g: g++ -c my_code.cpp -o my_code.o STEP-2: [LINUX] involves using ar (a Linux archive utili...