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

Code Coverage for static library with Ada main

George_V_3
Beginner
1,662 Views

I've inherited a huge Fortran library that is built under Microsoft Visual Studio as a static library and subsequently linked into an executable using an Ada build tool with an Ada main program.

Need to develop formal tests and would love to use Code Coverage.

I've only seen examples of using Code Coverage where the executable is built with the Intel Fortran compiler.

Is it possible to (manually) link in the Code Coverage libraries needed for an externally generated executable?

I currently get several unresolved symbols: _PGOPTI_Prof_Begin_V13, _PGOPTI_Prof_Div_VP_V13, _PGOPTI_Prof_Icall_V13

I realize this may be out of the intended scope for the product...

 

0 Kudos
3 Replies
TimP
Honored Contributor III
1,662 Views

I'm guessing you may have built your libraries with -prof-gen set, but haven't included the associated Intel compiler library libipgo.lib in the final link, as -prof-gen should do if you could use an Intel compiler to drive the final link.

0 Kudos
Kevin_D_Intel
Employee
1,662 Views

As Tim indicates, if you build the library with /Qcov_gen and then add path to the Intel libraries it appears you should be able to do this.

I did this with a main program built by the Microsoft C compiler by using the Fortran Mixed Language Sample included with Parallel Studio XE 2016 which includes a C main calling a Fortran Static library. First, build the static library with /Qcov_gen. Next, compile/link the C main either using the MS C compiler under the MSVS IDE or via the command-prompt and provide a path to the Intel Compiler libraries (in my case, %IFORT_COMPILER16%"\compiler\lib\ia32_win). When the main program runs and calls the Fortran static lib, the library code generates the profile information that you can then use with profmerge/codecov utilities.

The article, Configuring Visual Studio for Mixed-Language Applications, gives details of setting up the VC++ directories for a mixed-language application. You can apply the information about library paths to your manual link line.

Here is another recent related thread about using Code Coverage with a Static library,  https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/586091

0 Kudos
George_V_3
Beginner
1,662 Views

Thanks!

libipgo.lib plus oldnames.lib resolved all remaining symbols.

The code coverage reports are great!

 

 

0 Kudos
Reply