Linking your compiled applications with XL Fortran

By default, you do not need to do anything special to link an XL Fortran program. The compiler invocation commands automatically call the linker to produce an executable output file.

For example, you can use xlf to compile file1.f and file3.f to produce object files file1.o and file3.o; after that, all object files, including file2.o, are submitted to the linker to produce one executable.
xlf file1.f file2.o file3.f

Compiling and linking in separate steps

To produce object files that can be linked later, use the -c option.

xlf -c file1.f                # Produce one object file (file1.o)
xlf -c file2.f file3.f        # Or multiple object files (file2.o, file3.o)
xlf file1.o file2.o file3.o   # Link object files with default libraries


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us