Linkers, Loaders and Libraries Flashcards
Libraries
Ready-compiled and tested programs that can be run when needed
- Typically grouped together into software libraries
- Most programming languages have extensive pre-built functions
Dynamic Link Libraries
Contain sub-routines written to carry out common tasks on the Windows OS
All the programmer needs to do is call the appropriate DLL sub-routine with correct parameters, and the Save As dialogue box appears.
Benefits of library routines
Benefits:
- Quick and easy to use and hook into your own code
- Pre-tested, so you can be relatively sure they already free from errors
- Pre-compiled, so they are typically optimised to run quickly
Drawbacks of library routines
Drawbacks:
- Adding functionality or making specific tweaks can be difficult/impossible
- Sometimes you are ‘black-boxed’ from actual implementation
- You have to trust that the developers will continue to maintain the library
Linker
Linker is responsible for putting the appropriate machine address in all the external call and return instructions so all modules and external library routines are linked together correctly
Also links any separately complied into subroutines into the object code.
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.
Dynamic Linking
Compiled versions of the required libraries are stored on the host computer
OS links the required code from the library as the program is running
While this cuts down on the size of the complied machine code, if the dynamic libraries change the program may stop as it tries to call subroutines in the wrong way
Loader
The loader is the part of the OS that loads the executable file (machine code) into memory, ready to be run
When using dynamic linking, it will also be responsible for loading required libraries into memory