### Dynamic Link Libraries

Dynamic linking is the process of resolving references to external data and code at runtime or loadtime instead of at link time. A dynamic link library (DLL) is an object module which can be shared by more than one process.

It contains executable code for common functions, just as a static library (.lib) file does. However, when you link with a DLL (using an import library), the code in the DLL is not copied into the executable file. Instead, only the import definitions for DLL functions are copied, resulting in a smaller executable. At run time, the dynamic link library is loaded into memory, along with the .exe file.

You can dynamically link with the supplied IBM C and C++ Compilers runtime DLLs, as well as with your own DLLs.

There are two types of dynamic link libraries:

- DLLs which contain code. These can link statically or dynamically link to the IBM C and C++ Compilers runtime, can support multithread or singlethread executables, and can use the full system or only the subsystem libraries.
- DLLs which do not contain code, for example, resource DLL's which contain only resources such as menus or icons.

Advantages of Using a Dynamic Link Library

- Smaller memory requirement as several applications can all share the same dynamic link library instead of each application having its own copy of the functions contained in the DLL.
- Simplified application modification because modifications to an application's object module does not necessitate recompilation of the DLL.
- Flexible software support as DLL object modules can be replaced with newer versions without forcing recompilation of the application code.
- Your applications link more quickly, because the linker does not have to copy code from the library into your program.

Linking
Static and Dynamic Linking
Resource DLLs

Create a DLL -- An Overview
Debug a DLL