Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

building static libraries

Abraham_M_
Beginner
380 Views

Hi all,

I build an static library with visual studio 2008|Intel XE 2013. The resulting "mystatic.lib" file forces the .dll that links with it (from another project) to link with some intel .libs (libmmd.lib, libirc.lib...), but that DLL is built in MSVC, not Intel.

I solve this linking with the static libraries (libmmds.lib, svml_disp.lib...) and adding the following pragmas to the project that builds the .lib file:

#if defined(__INTEL_COMPILER) && defined(MYSTATICLIB)
# if defined(_MT) && defined(_DLL)
# pragma comment(linker, "/NODEFAULTLIB:libmmd")
# pragma comment(linker, "/NODEFAULTLIB:libirc")
# pragma comment(linker, "/NODEFAULTLIB:libdecimal")
# pragma comment(linker, "/NODEFAULTLIB:svml_disp")
# pragma comment(linker, "/NODEFAULTLIB:svml_dispmd")
# endif
#endif

So the user that link with our .lib created with intel compiler, from his msvc DLL project.

My question is: is there a way to avoid thesse pragmas? I can't find out where the intel compiler adds these default lib dependencies to the static lib.

Searching internet I found a compiler flag -static-intel, but building the static librari intel doesn't recognize it. I suspect that it is only valid for building .dll/.exe, not .lib static files.

0 Kudos
1 Reply
SergeyKostrov
Valued Contributor II
380 Views
>>...My question is: is there a way to avoid thesse pragmas? Could you explain why you don't like these pragmas? I use a similar approach in a project and it provides lots of flexibility over using any settings in a project file.
0 Kudos
Reply