# Dynamically Link Intel-Provided Libraries

This content is specific to C++; it does not apply to DPC++.

By default, some of the Intel support and performance libraries are linked statically into an executable. As a result, the library codes are linked into every executable being built. This means that codes are duplicated.

It may be more profitable to link them dynamically.

Options to specify:

Linux*: | -shared-intel
Windows*: | /MD ### Note Option /MD affects all libraries, not only the Intel-provided ones.

Advantages of this method: | Performance of the resulting executable is normally not significantly affected. Library codes that are otherwise linked in statically into every executable will not contribute to the code size of each executable with this option. These codes will be shared between all executables using them, and will be available independent of those executables.
Disadvantages of this method: | The libraries on which the resulting executable depends must be re-distributed with the executable in order for it to work properly. When libraries are linked statically, only library content that is actually used is linked into the executable. Dynamic libraries, on the other hand, contain all the library content. Therefore, it may not be beneficial to use this option if you only need to build and/or distribute a single executable. The executable itself may be much smaller when linked dynamically, compared to a statically linked executable. However, the total size of the executable plus shared libraries or DLLs may be much larger than the size of the statically linked executable.

Parent topic: Methods to Optimize Code Size