I am compiling a Fortran library (let's call it library A) that references some MKL functions and I have it set up as "Multithreaded" so that the MKL functions are statically linked and I don't have to ship MKL DLLs with my application.
In one case I am linking library A into an application that uses some MKL functions (via library A) and so I have also set up the application as "Multithreaded". It works fine.
In another case I am linking library A into a different application that doesn't use any MKL functions and so I have set up that application as "Multithread DLL". The reason I have set up the second application as "Multithread DLL" is because I don't want it to statically link in a whole host of other runtime libraries that it references. Is this allowed or am I asking for trouble by doing this?
The best thing when building a Fortran library is to set the option to disable library OBJCOMMENT directives so that the choice of library type is done by the executable application when it is linked. In Visual Studio, this is Fortran > Libraries > DIsable OBJCOMMENT directives... > Yes.
Note that you don't have this freedom in C/C++, as that compiler generates different code depending on the run-time library type setting, but Intel Fortran does not.
Note that this does mean that the executable needs to explicitly link to the appropriate Fortran support libraries. If the main program is in Fortran, that happens automatically.
So if I disable library OBJCOMMENT directives in library A, does the Multithreaded vs Multithreaded DLL setting matter when I'm compiling that library?