linkers, loaders and libraries Flashcards
what are libraries ?
they are ready compiled and tested programs that can run when needed.
what are some advantages of the libraries ?
- quick and easy to to use within your code.
- they are pre tested, therefore they will be free from errors.
- they are also pre compiled, therefore they will be optimised to run and execute quickly.
disadvantages of libraries
- adding functionality or making some specific tweaks can be hard to do.
- sometimes you will be black boxed from the actual implementation, this means that you will not know how efficient the library routine is.
3 you have to trust that the developers will continue to maintain the library and that they have tested it completely.
what is the linker responsible for ? and why does it do what it does ?
the linker is responsible to add the appropriate machine addresses in all of the external calls and return instructions.
it also links any separately compiled subroutines into the object code.
the linker does this to make sure that all the modules are linked correctly to the external library routines.
What happens in static linking ?
- modules and libraries are added directly to the main file, as a result of this the size of the file will increase.
- changes made to the modules and libraries externally will not affect the program, therefore specific or different versions of libraries can be used.
What happens in dynamic linking?
- Addresses of the module and libraries used is included in the main file and only referenced , therefore the size of the file will be smaller.
- When the program is run the loader will retrieve the program at the specified addresses so it can be executed.
- When the libraries and modules get updated the program will automatically have the updated versions with no need to update or recompile the code because they are only referenced.