what is the difference between linking and loading in c language

后端 未结 7 1663
庸人自扰
庸人自扰 2021-02-04 06:15

Does linking and loading of the the dynamic libraries both happen at runtime? or is it that only loading of the library happens at run time?

7条回答
  •  再見小時候
    2021-02-04 07:01

    file01.c, file02.c --> produces --> file01.o, file02.o --> These .o informations are clubbed and put into a single dynamic library, that is lib1.a file11.c, file12.c --> produces --> file11.o, file12.o --> These .o informations are clubbed and put into a single dynamic library, that is lib2.a

    Now, I have 2 libraries that is finally linked together to generate the executable (like .elf or .mot or .fls). This process of linking information from lib1.a and lib2.a to form a single executable is called linking.

    Now, I need to load this into memory in order to run it to see the behaviour of the final executable. The process of loading the final executable (like .elf or .mot or .fls) into memory in order to run that is called loading.

    I hope this would clear the importance of linking and loading (however the definitions are not appropriate :-)).

提交回复
热议问题