Search code examples
c++visual-studio-2013intel-mkl

Build custom Intel MKL DLL which doesn't depend on MSVCR120.DLL


I'm building a custom Intel MKL DLL (2019 Update 2) using the following command:

nmake libintel64 MKLROOT="C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\mkl" name=win\intel64\custom_mkl interface="lp64"

Using dumpbin I can see the the custom_mkl.dll depends on MSVCR120.DLL and libiomp5md.dll. The second dll seems to be ok and has to redistributed as well.

Is it possible to build a custom Intel MKL DLL which doesn't depend on MSVCR120.DLL?

I saw that there is a crt = <c run-time library> parameter but I don't know if this could help.

I cannot directly use the /MT option with the above command.


Solution

  • I can build a custom Intel MKL DLL which doesn't depend on MSVCR120.DLL using the following command with the addition argument crt=libcmt.lib:

    nmake libintel64 MKLROOT="C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\mkl" name=win\intel64\custom_mkl interface="lp64" crt=libcmt.lib
    

    The following answer helped me:

    There are 4 versions of the CRT link libraries present in vc\lib:

    • libcmt.lib: static CRT link library for a release build (/MT)
    • libcmtd.lib: static CRT link library for a debug build (/MTd)
    • msvcrt.lib: import library for the release DLL version of the CRT (/MD)
    • msvcrtd.lib: import library for the debug DLL version of the CRT (/MDd)

    see https://stackoverflow.com/a/3007915/7556646