The output produced by the ifort command includes:
An object file, if you specify the -c (Linux and Mac OS) or /c (Windows) option on the command line. An object file is created for each source file.
An executable file if you omit the c option.
One or more module files (such as datadef.mod), if the source file contains one or more MODULE statements.
A shareable library (such as mylib.so on Linux, mylib.dylib on Mac OS*, or mylib.dll on Windows), if you use the -shared (Linux), -dynamiclib (Mac OS) or /libs:dll (Windows) option.
Assembly files, if you use the -S (Linux and Mac OS) or /S (Windows) option. This creates an assembly file for each source file.
You control the production of output files by specifying the appropriate compiler options on the command line or using the appropriate properties in the Windows or Mac OS integrated development environment (IDE).
For instance, if you do not specify the c option, the compiler generates a temporary object file for each source file. It then invokes the linker to link the object files into one executable program file and causes the temporary object files to be deleted.
If you specify the c option, object files are created and retained in the current working directory. You must link the object files later. You can do this by using a separate ifort command; alternatively, you can call the linker (ld for Linux and Mac OS or link for Windows) directly to link in objects. On Linux and Mac OS systems, you can also call xild or use the archiver (ar) and xiar to create a library. For Mac OS, you would use libtool to generate a library.
If fatal errors are encountered during compilation, or if you specify certain options such as c, linking does not occur.
The output files include the following:
Output File | Extension | How Created on the Command Line |
---|---|---|
Object file |
.o (Linux and Mac OS) |
Created automatically. |
Executable file |
.out (Linux and Mac OS) |
Do not specify c. |
Shareable library file |
.so (Linux) |
Specify-shared (Linux), -dynamiclib (Mac OS) or /libs:dll (Windows) and do not specify c. |
Module file |
.mod |
Created if a source file being compiled defines a Fortran module (MODULE statement). |
Assembly file |
.s (Linux and Mac OS*) |
Created if you specify the S option. An assembly file for each source file is created. |
To allow optimization across all objects in the program, use the -ipo option.
To specify a file name for the executable program file (other than the default) use the -o output (Linux and Mac OS) or /exe:output (Windows) option, where output specifies the file name.
You cannot use the c and o options together with multiple source files.