ishan3243
ishan3243

Reputation: 1928

dynamic linking v/s dynamic loading

I have read quite a lot of sources on this topic but am still stuck at some concepts.

--I understand that in dynamic linking, linking is postponed until runtime i.e., we don't know where the library code is going to be placed relative to the main source at compile time. This helps in implementing the shared library concept i.e., the library code being used by some other process can be used by this process.

--What I don't understand is whats happening in dynamic loading. Is the linking done statically in this? If it is statically done, then what could be the purpose of postponing loading until run-time? Is this automatic or does the programmer needs to intervene (make some calls to load the library)?

Thanks!

Upvotes: 1

Views: 1986

Answers (1)

SomeWittyUsername
SomeWittyUsername

Reputation: 18368

These are 2 different concepts. I won't elaborate regarding the dynamic linking, your description is pretty sufficient.

Dynamic loading means that some part of executable code is loaded not upon program start into the memory but later during the execution, typically upon demand. The code resides in some external library.

Reasons for dynamic loading might be various, usually they will be related to resources utilization - e.g., minimizing the RAM usage during execution, minimizing the loading time upon program start, etc.

Usage of dynamic loading isn't controlled by the OS but rather by the programmer via OS-provided functionality. The code residing in external library, the main program interfaces and loads it at some stage according to the native logic of the program.

Upvotes: 3

Related Questions