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

Mixed language Fortan - C++ problem with Parallel Studio XE 2017

Nicholas_B_
Beginner
463 Views

I have been having a problem with mixed language Fortran - C++ projects with the new 2017 compilers.

The 2017 libifcoremd.lib and libifcoremdd.lib libraries now include a defaultlib directive for static Standard C++ library libcpmt but the C++ part of my application uses the dynamic link versions msvcprt.lib or msvcptrd.lib and the linker complains about this.

Using the /nodefaultlib linker option for the libcpmt.lib library allows the application to link but my application crashes with the new compiler. Is it safe to use the /nodefaultlib:libcpmt or could this be the cause of the crashes? 

C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.109\windows\compiler\lib\intel64>dumpbin /DIRECTIVES libifcoremd.lib
Microsoft (R) COFF/PE Dumper Version 12.00.40629.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file libifcoremd.lib

File Type: LIBRARY

   Linker Directives
   -----------------
   -defaultlib:libcpmt
   -defaultlib:libirc

...

C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.3.207\windows\compiler\lib\intel64>dumpbin.exe /DIRECTIVES libifcoremd.lib
Microsoft (R) COFF/PE Dumper Version 12.00.40629.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file libifcoremd.lib

File Type: LIBRARY

   Linker Directives
   -----------------
   -defaultlib:libirc

...

 

 

 

 

0 Kudos
4 Replies
Steven_L_Intel1
Employee
463 Views

Patient: Doctor, it hurts when I do this!
Doctor: Well, then don't do that!

Link to the DLL Fortran libraries, don't mix static and dynamic this way - you'll only hurt yourself.

0 Kudos
Nicholas_B_
Beginner
463 Views

How do you tell Parallel Studio XE 2017 to use DLL libraries?

I have a Fortan main program project using a C++ static library.

The Fortan project uses:
Runtime Library: Debug Multithread DLL (/libs:dll /threads /dbglibs)

The C++ project uses: 
Runtime Library: Multi-threaded Debug DLL (/MDd)

Adding /VERBOSE to the link line I see that libifcoremdd.lib is used and libifcoremdd.lib uses libifcoremdd.dll.

dumpbin /DIRECTIVES on libifcoremdd.lib shows that it uses libcpmt.lib (-defaultlib:libcpmt) for the static C++ standard library when I would expect it to use msvcprtd.lib for the dynamic link C++ standard libary.

The verbose linker output shows that both libcpmt.lib and msvcprtd.lib are being searched.
In simple "hello word" style tests the linker output shows that libcpmt.lib is unused but in my real application there is a conflict.

The Parallel Studio XE 2016 libifcoremdd.lib did not have -defaultlib:libcpmt and I had no problem linking my application.

 

 

 

0 Kudos
Steven_L_Intel1
Employee
463 Views

Set the linker property General > Show Progress to "Show some progress messages", rebuild and post a ZIP of the buildlog.htm here. Or read it yourself to see where each library was referenced. You may be pulling in object or library you didn't rebuild. The properties you mentioned above are how you set the libraries.

0 Kudos
Nicholas_B_
Beginner
463 Views

Thank you for your advice.

I tracked the linker problem down to using boost without defining BOOST_ALL_DYN_LINK.

The crash turned out to be due to a new bug with omitted intent out optional arguments with abstract types (I will post an example in a new thread).

 

 

0 Kudos
Reply