in this video we take a look at linkers and loaders and the use of libraries [Music] so first of all what exactly are libraries while they're ready compiled and tested programs that can be run when needed they're typically grouped together in what's known as software libraries most programming languages have extensive built-in libraries so for example shown here on the screen is the maths library from python and it provides a set of common solutions to everyday problems encountered by programmers who are dealing with numbers someone programming in the windows operating system for example can make use of the windows dynamic link libraries or dols these libraries contain subroutines written to carry out many common tasks on the windows operating system for example save as where the user needs to save their work as a file all the program would need to do is call the appropriate dynamic link library subroutine with the correct parameters and the save as dialog box will simply appear in their program so there are obviously lots of benefits to using libraries firstly they're quick and easy to use and hook into your own program they are obviously pre-tested so you can be relatively sure they're already free from errors they're pre-compiled so they typically are optimized to run quickly there are a few drawbacks from using library teams adding your own additional functionality or making specific tweaks to a library subroutine can be difficult or indeed impossible sometimes you are what is known as black boxed from the actual implementation so you have no idea how efficient the actual library routine is you have to trust that developers will continue to maintain the library and have tested it completely so now we've discussed libraries let's look at what linkers and loaders are the linker is responsible for putting the appropriate machine addresses in all the external call and return instructions so all modules and any external library routines are all linked together correctly in your finished code it's therefore responsible for linking any separate compiled subroutines into your object code the linker is able to use a couple of methods to pull in the various libraries it might need there's static linking so this is where all the required code from the libraries is included directly in your finished machine code of course this can result in large executable program files or we could use dynamic linking this is where compiled versions of the required libraries are stored on the host computer the operating system links the required code from the libraries as your program is running now of course this is going to cut down on the size of the compiled machine code but if these dynamic libraries change or don't exist on the host computer the program may stop working because it tries to call a subroutine in the wrong way the loader is the part of the operating system that loads the executable program file so that's the machine code into memory ready to be run when using dynamic linking it will also be responsible for loading the required libraries into memory so having watched this video you should be able to answer the following key question what is the purpose of a linker and loader and what are the advantages of function libraries for a programmer you