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

Including static runtime libraries in a custom static library

jonbnews
Beginner
623 Views
I'm using the Intel Fortan Compiler v7.1 plugged into VS.NET 2003. I have a project which builds to a static library, say MyLib.lib. It's set to use the static multithreaded fortran runtime libraries (/MT). When another (C++) project links to this library, I don't want it to also have to link to the static fortran runtime libraries. So, I added the libraries libircmt.lib, libmmt.lib, libF90MT.lib, libIEPCF90MT.lib, and libintrinsMT.lib to the Librarian-->Additional Dependencies field on the project properties of the MyLib project. This makes the library quite large, since it just includes all of those static libraries in the MyLib.lib static library.

When another project links against the MyLib.lib library, though, I get error messages saying "cannot open file 'libircmt.lib'" and "cannot open file 'libmmt.lib'". Of course, if I include the path to those libraries, it will link them fine, but I want it to pick up those from MyLib.lib.

I tried compiling MyLib.lib with the /Zl options (which supposedly removes references to default libraries) and I played around with the options to ignore default libraries and ignore specific libraries and such. Nothing helped.

We've been doing this with C++ libraries quite a bit, where we include all the static library dependencies in one static library so we don't have to link a ton of libraries in higher level projects.

I have a hunch as to why the problem is occuring which I'd like an opinion on. My hunch is that one or more of the static runtime libraries (libircmt.lib, libmmt.lib, libF90MT.lib, libIEPCF90MT.lib, libintrinsMT.lib) contains information about another static runtime library (i.e. was maybe compiled without the /Zl option). For example, perhaps libF90MT.lib is dependent on libmmt.lib (or vise-versa), so when the linker is searching MyLib.lib, and starts searching through libF90MT.lib contained in MyLib.lib, it sees that libF90MT.lib requires libmmt.lib and tries to load that library instead of searching the rest of MyLib.lib to find the appropriate symbols. I have no idea if this is really happening, it's just a hunch.

Any ideas anyone?
0 Kudos
0 Replies
Reply