Intel® Fortran Compiler XE 13.1 User and Reference Guides
The following applies to Microsoft Visual Studio* 2008 and 2010.
Fortran static libraries (.LIB) are blocks of code compiled and kept separate from the main part of your program. The Fortran static library is one of the Fortran project types.
To create a static library from the integrated development environment (IDE), select the Static Library project type. To create a static library from the command line, use the /c compiler option to suppress linking and use the LIB command.
When you create a static library, you are asked to specify whether you want to prevent the insertion of link directives for default libraries. By default, this checkbox is selected, which means insertion of link directives is prevented.
Select this option if you plan to use this static library with other Fortran projects. The option prevents the static library from specifying a version of the Fortran run-time library. When the static library is linked with another Fortran project, the Fortran run-time library choice in the other Fortran project is used for the static library as well.
You may decide against selecting this option if you plan to use this static library with C/C++ projects. If you do select it, you need to explicitly name the Fortran run-time library to use in the Linker Additional Dependencies property. You can change your selection after creating the project using the Fortran Disable Default Library Search Rules property.
Static libraries offer important advantages in organizing large programs and in sharing routines between several programs. These libraries contain only subprograms, not main programs. A static library file has a .LIB extension and contains object code.
When you associate a static library with a program, any necessary routines are linked from the library into your executable program when it is built. Static libraries are usually kept in their own directories.
Because applications built with a static library all contain the same version of the routines in the library, you can use static libraries to help keep applications current. When you revise the routines in a static library, you can easily update all the applications that use it by relinking the applications.
A static library is a collection of source and object code defined in the Solution Explorer window. The source code is compiled when you build the project. The object code is assembled into a .LIB file without going through a linking process. The name of the project is used as the name of the library file by default.
If you have a library of substantial size, you should maintain it in a dedicated directory. Projects using the library access it during linking.
When you link a project that uses the library, selected object code from the library is linked into that project's executable code to satisfy calls to external procedures. Unnecessary object files are not included.
When compiling a static library from the command line, include the /c compiler option to suppress linking. Without this option, the compiler generates an error because the library does not contain a main program.
To debug a static library, you must use a main program that calls the library routines. Both the main program and the static library should have been compiled using the debug option. After compiling and linking is completed, open the Debug menu and choose Go to reach breakpoints, or use the step controls on the Debug toolbar.
To add static libraries to a main project in the IDE, use the Add Existing Item... option in the Project menu. You can enter the path and library name with a .LIB extension in the dialog box that appears. If you are using a makefile, you must add the library by editing the makefile for the main project. If you are building your project from the command line, add the library name with a .LIB extension and include the path specification if necessary.