Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7032 Discussions

Choosing static or dynamic linking of MKL in Visual Studio?

Dear Intel,

I am building a C++ application that uses MKL in Visual Studio. How do I choose between static or dynamic linking? The default seems to be dynamic linking, but I cannot find a way to change to static linking (desired for this application).

Please advise. All the best,

Bjrn Nilsson
Lund, Sweden
0 Kudos
1 Reply
Honored Contributor III
The link advisor tool at the top of the forum (and in your installation) is the best source for a recommendation about link options. Static linking may possibly improve performance, but you won't see the difference unless you disable dynamic processor speed stepping. It will make your .exe much larger, but will avoid having to install the MKL distributable library on each platform you run on.
The libiomp5 is handled separately from the static link options you will see in link advisor. Default is to use dynamic even when everything else is static /MT. You would have to name the MT openmp library version explicitly in your link step. You must take care then that you link it only once, in the final link, not when making a .dll, and that you also avoid linking the vcomp, which it replaces.
0 Kudos