Welcome to Intel® Software Network Quick Login | Join | Help |
Search in Intel® Software Network Forums
in Go

Visibility of LIB files within a solution

Last post 05-14-2008, 5:52 AM by Steve Lionel. 4 replies.
Sort Posts: Previous Next
 05-13-2008, 11:46 AM 30254740  

Visibility of LIB files within a solution

We are attempting to migrate a rather large Fortran/C (mostly Fortran) program from VS 2003/IVF 8 to VS 2005/IVF 10.1.  The program compiles and links just fine under the old combination, but fails to link when using the new combination.  The problem lies in the fact that the main project cannot "see" the .lib files generated by the supporting projects in the solution.  In order to get the solution to link, I have to add the individual .lib files to the main project.

Is there some setting that I'm missing in either VS 2005 or IVF 10.1 that makes the libraries from all of the projects in a solution available to the main project???

Thanks for any assistance,

cje 

 
 05-13-2008, 12:11 PM 30254743 in reply to 30254740  

Re: Visibility of LIB files within a solution

You need to install VS2005 SP1 - this is a VS bug and is noted in the Fortran release notes as follows:

Mixed-Language Applications in Visual Studio 2005

In Microsoft Visual Studio 2005 with a C/C++ main program and a Fortran static library dependent project, Visual Studio no longer looks for the output file (typically a .lib) of non-C/C++ dependent projects. The alternative is to add the dependent project's .lib as a "source file" or to give its full path on the Linker property page as an "Additional Dependency". This issue is resolved in Visual Studio 2005 Service Pack 1.



Steve

Doctor Fortran: intel.com/software/drfortran
 
 05-13-2008, 1:02 PM 30254746 in reply to 30254743  

Re: Visibility of LIB files within a solution

Thanks for the quick response, Steve.  I just got everything installed on a new computer, so the Service Pack has not been pushed to me yet.  I'll call our IT folks and get 'er done.

Guess it boils down to RTFM.  Thanks again.

 
 05-14-2008, 5:32 AM 30254794 in reply to 30254746  

Re: Visibility of LIB files within a solution

Steve,

Just got Service Pack 1 installed and the issue is better, but still remains to some extent. 

For my Solution, I am provided with several static libraries (no source code provided) and it seems that whenever one of these libraries calls a routine that is contained in a separate project (source code included in Solution), that I need to call in the .lib file for the separate project (i.e. precompiled static libraries cannot link to project libraries that are compiled as part of my solution).

Note that this solution compiles and links under VS 2003/IVF 8 without the need to add in the extra library links to the main project. 

Any further ideas?

cje

 
 05-14-2008, 5:52 AM 30254797 in reply to 30254794  

Re: Visibility of LIB files within a solution

My guess is that the order of the libraries as presented to the linker is the issue.  The way the Microsoft linker (and every other linker I have known)  works is that it proceeds through the list of input files it is given - objects and libraries - and builds a list of resolved and unresolved symbols.  For each input file, it keeps searchig that file until no further unresolved symbols are resolved, then closes it and moves to the next one.

So let's say you have libraries A, B and C.  A has calls to routines in B, B has calls to routines in C and C has calls to routines in A.  When the linker gets to C, it is done with A and B and if an unresolved reference would be satisfied by A, well, too bad.

It would be instructive to look at the link command as shown in the project build log, and perhaps compare that to what you see in VS2003.  For the structure of your application, you may need to force one or more libraries to the end of the list, or even specify them twice (under "Additional Dependencies" in the Linker > Input property page.)

The compiler has no control over the order of libraries.

Steve

Doctor Fortran: intel.com/software/drfortran
 
View as RSS news feed in XML

Shortcuts


Tags For This Post

...

Community Tags

...