开发者

Why does intel compiler produce output that requires libiomp5mt.dll, even though I ask for static linking?

开发者 https://www.devze.com 2023-04-01 16:07 出处:网络
I\'m compiling an openmp project with the /MT switch (or equivalently in visual studio settings, \"C++: Code Generation: Runtime Library: Multi Threaded\".

I'm compiling an openmp project with the /MT switch (or equivalently in visual studio settings, "C++: Code Generation: Runtime Library: Multi Threaded".

Visual Studio still, however, reports that my output requires libiomp5mt.dll (multi threading dll) when I thought the above setting was asking for static linking.

Is there another option somewhere I missed?

Alternatively, if the dll is a requirement, I presume I'm allowed to redistribute Intel's dll alongside my 开发者_如何学Goown application?


The Intel website says:

You are strongly encouraged to dynamically link in the compatibility OpenMP* run-time library libiomp (i.e libiomp5md.lib and libiomp5md.dll , located in the [Compiler Dir]\lib directory), even if other libraries are linked statically. Linking to static OpenMP* run-time library (i.e libiomp5mt.lib) is not recommended. Because multiple OpenMP libraries in one appliation causes performance problems (too many threads) and may cause correctness problems if more than one copy is initialized.

So although you can configure OpenMP to link statically, and this configuration is independent of the C runtime, you are recommended not to.

Intel's OpenMP licence allows for royalty free redistribution as far as I can tell. You should check the licence that came with your OpenMP just to be on the safe side.


The above switch is for C++ runtime only, OpenMP is an external library which is not a part of the C++ runtime. Hence the switch doesn't have any effect on it.

As per the redistribution of the DLL, look at the license of the product the DLL was shipped with. You're probably allowed to redistribute it.


There are two ways of creating code libraries. As static Libs and as Dlls (Extentsions: *.lib and * dll).

If there is only a Dll available, you can only link to it dynamically, not statically. What may be confusing you is that a Dll usually has a lib file you link to which has all the entry points into the Dll.

0

精彩评论

暂无评论...
验证码 换一张
取 消