(This is the older material - click here - for current specification content)

15. Library Routines

At the beginning, every programmer had to write their code by hand

 

They were very clever people as they were the pioneers of the whole computer age, no one before them had done what they were doing, so it was exciting times to be an electronic engineer or computer scientist (it still is, but for different challenges!).

But it does not need to be so hard these days.

If someone has spent days, weeks, months perfecting code to handle an user interface or file management system, it makes little sense in you doing the same thing even if you were inclined to do so. This is where libraries come in.

Libraries are a collection of ready-made sub-routines that can be called by programs executing within the host operating system.

For example, someone programing in the Windows operating system can call 'Dynamic Link Libraries' or DLL for short. These libraries contain sub-routines written to carry out a common task in the Windows environment. For example a 'Save As' routine where the user of your program needs to save their work as a file. All you need to do in your program is to call the appropriate DLL sub-routine with the correct parameters and the 'Save As' dialogue box appears.

An utility called a 'loader' loads the subroutine into memory then another utility called a 'linker' links the code into the relevant part of the main program.

Pros and Cons

Dynamic Link Libraries have the advantage of making your execution (exe) file smaller as their code is only called into memory when one of their sub routines needs to run.

Dynamic Link Libraries can be written by anyone so it allows people to share code within a host operating system. But in reality most DLLs used are those that come with the operating system.

The disadvantage of dynamic link libraries is if they change over time. The way an exe file calls a particular sub-routine might not be correct any more. So the program appears broken when in fact it is down to the current DLL being different to the original version.

Other libraries

Other operating systems such as Unix and Linux also make heavy use of libraries, especially in the graphical user interface where hundreds / thousands of hours of coding time has been spent making a pleasant user interface to the system. For example GNOME and the KDE desktop environments.

Another important use of libraries is in scientific and engineering computing. There are vastly complicated libraries that engineers and scientist can purchase to analyse their data. This is very cost-effective as they make use of some of the best mathematics brains in the world to make sense of their data.

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Dynamic Link Library

 

Copyright © www.teach-ict.com