difference between dynamic loading and dynamic linking?

前端 未结 8 926
你的背包
你的背包 2020-12-02 12:16

Routine is not loaded until it is called. All routines are kept on disk in a re-locatable load format. The main program is loaded into memory & is execute

相关标签:
8条回答
  • 2020-12-02 12:58

    Dynamic linker is a run time program that loads and binds all of the dynamic dependencies of a program before starting to execute that program. Dynamic linker will find what dynamic libraries a program requires, what libraries those libraries require (and so on), then it will load all those libraries and make sure that all references to functions then correctly point to the right place. For example, even the most basic “hello world” program will usually require the C library to display the output and so the dynamic linker will load the C library before loading the hello world program and will make sure that any calls to printf() go to the right code.

    0 讨论(0)
  • 2020-12-02 13:00

    There are two types of Linking Static And Dynamic ,when output file is executed without any dependencies(files=Library) at run time this type of linking is called Static where as Dynamic is of Two types 1.Dynamic Loading Linking 2.Dynamic Runtime Linking.These are Described Below

    Dynamic linking refers to linking while runtime where library files are brought to primary memory and linked ..(Irrespective of Function call these are linked).

    Dynamic Runtime Linking refers to linking when required,that means whenever there is a function call happening at that time linking During runtime..Not all Functions are linked and this differs in Code writing .

    0 讨论(0)
  • 2020-12-02 13:01

    Dynamic loading refers to mapping (or less often copying) an executable or library into a process's memory after it has started. Dynamic linking refers to resolving symbols - associating their names with addresses or offsets - after compile time.

    Here is the link to the full answer by Jeff Darcy at quora

    http://www.quora.com/Systems-Programming/What-is-the-exact-difference-between-Dynamic-loading-and-dynamic-linking/answer/Jeff-Darcy

    0 讨论(0)
  • 2020-12-02 13:05

    Dynamic loading means loading the library (or any other binary for that matter) into the memory during load or run-time.

    Dynamic loading can be imagined to be similar to plugins , that is an exe can actually execute before the dynamic loading happens(The dynamic loading for example can be created using LoadLibrary call in C or C++)

    Dynamic linking refers to the linking that is done during load or run-time and not when the exe is created.

    In case of dynamic linking the linker while creating the exe does minimal work.For the dynamic linker to work it actually has to load the libraries too.Hence it's also called linking loader.

    Hence the sentences you refer may make sense but they are still quite ambiguous as we cannot infer the context in which it is referring in.Can you inform us where did you find these lines and at what context is the author talking about?

    0 讨论(0)
  • 2020-12-02 13:09

    Dynamic Loading: Load routine in main memory on call.

    Dynamic Linking: Load routine in main memory during execution time,if call happens before execution time it is postponed till execution time.

    Dynamic loading does not require special support from Operating system, it is the responsibility of the programmer to check whether the routine that is to be loaded does not exist in main memory.

    Dynamic Linking requires special support from operating system, the routine loaded through dynamic linking can be shared across various processes.

    Routine is not loaded until it is called. All routines are kept on disk in a re-locatable load format. The main program is loaded into memory & is executed. This is called Dynamic Linking.

    The statement is incomplete."The main program is loaded into main memory & is executed." does not specify when the program is loaded.

    If we consider that it is loaded on call as 1st statement specifies then its Dynamic Loading

    0 讨论(0)
  • 2020-12-02 13:12

    We use dynamic loading to achieve better space utilization

    • With dynamic loading a program is not loaded until it is called.All routines are kept on a disk in a relocatable load format.The main program is loaded into memory and is executed.
    • When a routine needs to call another routine, the calling routine first checks to see whether has been loaded.If not , the relocatable linking loader is called to load the desired routine into memory and update program's address tables to reflect this change.Then control is passed to newly loaded routine

    Advantages

    1. An unused routine is never loaded .This is most useful when the program code is large where infrequently occurring cases are needed to handle such as error routines.In this case although the program code is large ,used code will be small.
    2. Dynamic loading doesn't need special support from O.S.It is the responsibility of user to design their program to take advantage of method.However, O.S can provide libraries to help the programmer
    0 讨论(0)
提交回复
热议问题