Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28381 Discussions

mkl_intel_thread.dll missing when building via VS2019, but not missing when building via cmd

Edson
Beginner
1,293 Views

Hello,

I wrote a Fortran application that uses MKL and successfully built and debugged it via Visual Studio. But if I try to run the executable, it says that the mkl_intel_thread.dll is missing. I've searched for it, and I know I can just include the dll in my source folder, but my question is: when I compile the source file with the Intel compiler via command line, I get a standalone executable, i.e., it won't ask for the dll even if it's not there. How's that possible? I used the following command to build via cmd:

ifort /Qmkl test.f90

Is the command "ifort /Qmkl" "embedding" the dll information in the executable somehow? If so, is it possible for the VS to do the same?

Best regards.

0 Kudos
1 Solution
Steve_Lionel
Honored Contributor III
1,272 Views

Yes, it is possible. The default when building in Visual Studio is to link to the DLL libraries, whereas the default on the command line is to link to the static libraries.

In Visual Studio, set the project property Libraries > Use Run-Time Library to Multithreaded (/MT).

View solution in original post

3 Replies
Steve_Lionel
Honored Contributor III
1,273 Views

Yes, it is possible. The default when building in Visual Studio is to link to the DLL libraries, whereas the default on the command line is to link to the static libraries.

In Visual Studio, set the project property Libraries > Use Run-Time Library to Multithreaded (/MT).

Steve_Lionel
Honored Contributor III
1,271 Views

I will also mention that the reason it won't run from the command line is that the default is to not add the MKL DLL folder to PATH.

mecej4
Honored Contributor III
1,267 Views

There are some misunderstandings in the post regarding the role of DLLs and import libraries.

...when I compile the source file with the Intel compiler via command line, I get a standalone executable, i.e., it won't ask for the dll even if it's not there. 

The DLL is not used when compiling and linking, only the corresponding import library (e.g., mkl_rt.lib) is used. If you try to run the resulting EXE, that will work only if the DLL is available through %PATH%. If that is the problem, the fix is to adjust %PATH%, either in the local environment (recommended) or in the global environment (can create problems, but is convenient).

Is the command "ifort /Qmkl" "embedding" the dll information in the executable somehow?

That the EXE depends on a particular DLL is embedded. The path to the DLL is not embedded

The DLL needs to exist only on the machine on which the EXE is to be run. The import library needs to exist only on the developer's machine.

Reply