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

LNK4099 with static library

jwasson
Beginner
2,127 Views

.There have been a few postings on LNK4099, for examples,

http://software.intel.com/en-us/forums/topic/311987
http://software.intel.com/en-us/forums/topic/321946
http://software.intel.com/en-us/forums/topic/388459

related to native libraries.  A recent (March, 2013) rebuild of a Fotran static library with

Intel(R) Visual Fortran Composer XE 2011 Integration for Microsoft Visual Studio* 2010, 12.0.3470.2010
/nologo /debug:full /Od /warn:interfaces /names:uppercase /iface:stdref /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc100.pdb" /traceback /libs:static /threads /dbglibs /c

used by a C++ dll has given LNK4099 errors for each of the Fortran routines

staticlib.lib(*.obj) : warning LNK4099: pdb 'vc100.pdb' was not found with 'staticlib.lib(*.obj)' or at z:\path\vc100.pdb'; linking object as if no debug info

used by the dll

file.h
extern "C" void __stdcall *(...)

where * = name of subroutine.

Excluding the staticlib.lib is not an option.  The Fortran settings (e.g.  STDCALL, REFERENCE (/iface:stdref)) have not changed.

Making the debug version of staticlib.lib without debug gets rid of the link warnings but this defeats the purpose of a debug build.

The LNK4099 diagnostics are just warnings but any advice on getting a successful debug build without LNK4099 would be welcome.

0 Kudos
5 Replies
Anonymous66
Valued Contributor I
2,127 Views

This warning means is the .pdb file for staticlib.lib was not found.  Debugging information is in the .pdb file. If you are copying the staticlib.lib file, make sure to copy or link to the .pdb file as well.

You can still run your program without any issues without the .pdb file.

0 Kudos
jwasson
Beginner
2,127 Views

Valid point Annalee.  Thanks for the quick response.  But what I did not make clear in the original post is that the staticlib.lib and pdb have not moved since the recent rebuild.  Before the recent rebuild there were no LNK4099 messages but after, with the the files still in the same default locations from the build (unchanged signatures of the subroutines and interfaces in file.h and same directives to the C++ linker for the path to the staticlib.lib), now there are LNK4099 warnings.

One odd LNK4099 diagnostic refers to an obj for a *.f file that has subroutine in the static library that 0) is called within the library but 1) is not called from the C++ dll and 2) does not have an interface (extern "C" void __stdcall *(...)) defined in file.h.  Don't know how the linker came up with this one or if there is some tool like dumpbin for a static library that might explain this.  Or if some explicit attributes should be made for subroutines in the static library to correspond to the interfaces in file.h (like dllexport for a dll).

0 Kudos
Anonymous66
Valued Contributor I
2,127 Views

The .pdb files were most likely deleated in the clean step of the rebuild.

0 Kudos
jwasson
Beginner
2,127 Views

You are right.  For sure the files were deleted during the build because they reappear with the same new time stamp

project_folder

     vc100.pdb

     Debug

        mystaticlib.lib

 in the (default) folders but after the rebuild the LNK4099 diagnostics appear when the C++ dll is built although the original build did not have any link errors.  I don't think any IVF project settings were changed.  Are there some project settings that would be useful to check?

 

 

0 Kudos
SergeyKostrov
Valued Contributor II
2,127 Views
>>... Are there some project settings that would be useful to check? You could compile the static library with /Z7 option and the pdb file won't be used.
0 Kudos
Reply