Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
29304 Discussions

Can I use a static library built with an earlier version if Intel Fortran?

cartman4
Beginner
826 Views
If I'm using Intel Fortran 10.1 can I link with a static library that was built with version 9.1?
0 Kudos
4 Replies
TimP
Honored Contributor III
826 Views
There are earlier posts on this forum which seem to fit the question, if I understand you correctly. If your library consists of objects built with ifort 9.1, those should link correctly against ifort 10.1 run-time libraries, if you use legacy OpenMP, or no OpenMP.
0 Kudos
cartman4
Beginner
826 Views
I've searched the forum but haven't been able to fine anything that addresses my problem. I'm building my app with Intel Visual Fortran 10.1 and trying to link to a static library that was built by a third party with the version 9.1 Intel Fortran compiler. My code and the library code are all Fortran so I'm not expecting any mixed language calling convention issues. I'm not using OpenMP either.

When I attempt to link I get an 'LNK2019: unresolved external symbol' error on a subroutine defined in the static library. I know it's finding the .lib files thought, because if I move them I get a 'cannot open input file...' error.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
826 Views
For what it's worth, I distribute my Xeffort library (xeffort.lib) as compiled with IVF 9.1, and no one has reported any problems so far. It links and works correctly with IVF 10.0 and 10.1. (Rationale: the reverse, i.e. distributing the .lib compiled with 10.x would cause LNK errors for users still on 9.x).

LNK2019 on subroutine defined in the static library indicates an error of yours (actually, just now I saw "third party") somewhere. The most likely cause, in my opinion, is that the .lib and the .exe have different name decoration conventions (Project/Properties/Fortran/External procedures). For example, if one was converted from a CVF project, the default convention is "cvf" (producing decorated name like "_SUBNAME@24"), but IVF default produces decorated names like "_SUBNAME".

You can see the actual "contents" of the .lib file using
dumpbin /symbols libname.lib > temp.txt
and then examining the temp.txt, searching for the symbol in question.
0 Kudos
cartman4
Beginner
826 Views
JugoslavDujic:
The most likely cause, in my opinion, is that the .lib and the .exe have different name decoration conventions (Project/Properties/Fortran/External procedures). For example, if one was converted from a CVF project, the default convention is "cvf" (producing decorated name like "_SUBNAME@24"), but IVF default produces decorated names like "_SUBNAME".

You can see the actual "contents" of the .lib file using
dumpbin /symbols libname.lib > temp.txt
and then examining the temp.txt, searching for the symbol in question.


You nailed it! I was using the CVF calling convention and the library was using the default. Thank you JugoslavDujic!!!
0 Kudos
Reply