1.2.2.7 Linkers and Loaders Flashcards
What is a library?
Ready-compiled and tested programs that can be run when needed.
What are dynamic link libraries (DLL)?
a module that contains functions and data that can be used by another module (application or DLL)
Positives of libraries
+ Quick and easy to use and hook into your own code
+ Pre-tested, so you can be relatively sure they are already free from errors.
+ Pre-compiled, so they are typically optimised to run quickly.
Negatives of libraries
-Adding functionality or making specific tweaks can be difficult – or impossible.
-Sometimes you are “black-boxed” from the actual implementation.
-You have to trust that the developers will continue to maintain the library.
What do linkers do?
The linker is responsible for putting the appropriate machine addresses in all the external call and return instructions so all modules and external call and return instructions so all modules and external library routines are linked correctly. It also links any separately compiled subroutines into the object code.
What are the two types of linking?
Static linking
Dynamic linking
What is static linking?
All the required code from the libraries is included directly in the finished machine code – this can result in large executable program files.
What is dynamic linking?
The operating system links the required code from the library as the program is running. While this cuts down on the size of the compiled machine code, if the dynamic libraries change, the program may stop because it tries to call a subroutine in the wrong way.
What is a loader?
The part of the operating system that loads the executable program file (machine code) into memory, ready to run. When using dynamic linking, it will also be responsible for loading the required libraries into memory.