The libraries can be linked to the executable in two ways . one is static linking and the other is dynamic linking. Static linking when building the program , the linker will search all the libraries for the unresolved functions called in the program and if found, it will copy the corresponding object code from the library and append it to the executable. It is easy to implementation but will generate bulky executable. In dynamic linking , the required functions are compiled and stored in a library with extension .DLL or exe here no object code is copied in to the executable from the libraries.Instead of when the executable is running , it will load the DLL and call the required functions from it. Thus we have a smaller executable .
A dynamic-link library (DLL) is an executable file that acts as a shared library of functions. Dynamic linking provides a way for a process to call a function that is not part of its executable code. The executable code for the function is located in a DLL, which contains one or more functions that are compiled, linked, and stored separately from the processes that use them. Only the information needed at run time to locate the executable code for a DLL function is in the executable module (either a .dll or .exe file). These libraries are "dynamically linked" because they are linked to an application when it is loaded and executed — rather than when it is created.
In the case of static linking, the linker gets all of the referenced functions from the static link library and places it with your code into your executable file.
Marked as answer byjack 321Tuesday, October 14, 2008 6:15 AM