Published · 1 min read

Linking: Static & Dynamic

When we compile a program, the code for the various in-built functions are copied from the appropriate libraries.

When we compile a program, the code for the various in-built functions are copied from the appropriate libraries. This process of linking of library functions during compilation is called Static Linking.

The process of linking of library functions during runtime is called Dynamic Linking. In Dynamic Linking, the code for the functions are not copied during compilation, rather only a reference to them is added. At runtime, the reference is resolved (when needed) and the code inside the library where the function definition exists is given the control. After completion the control is passed to the application.

Note:- Control here implies the flow of execution.

Dynamic Linking has various advantages when compared to static linking:-

  • Smaller Size of Compiled Application: The function definitions
  • Easy Updation: The program does not need recompilation if the library is updated.
  • Better Memory Usage: A Library can be shared by multiple programs, thus the memory requirement is reduced.

A compiled library file has an extension .dll which stands for Dynamic Link Library.

Partho Sarathi

Partho Sarathi

Founder, Maxotek

Programming Basics

Our blog

Related posts

Tutorials, notes and news from Maxotek.

  • Digital logic gates

    Digital logic gates is an electronic component which results perticular ouput after implementing its logic on the input signals.

    Partho Sarathi

    Partho Sarathi

  • 64-Bit Computing

    Around 2003 the term 64-Bit computing was everywhere. Want to install Windows XP? Great! Do you want the 32-Bit disc or 64-Bit disc? Installing WinZip for your shiny new re-installed OS?

    Partho Sarathi

    Partho Sarathi

View all posts

See what Maxotek makes

Monitoring, conversion tools and more, built by the same people who wrote these posts.