The Compile-Link-Run Cycle
- edit source files: .f, .for, .f90, .f95,
...;
- compile each source file to produce an object file: .o;
- link object files to produce an executable file --- static or dynamic
linking.
Compilation and linking may be combined into one step --- for small
programmes.
- We return to this subject (in the context of Makefiles) later.
Examples --- Cosmos, Sun F90 Compiler
Either:
use the 4.2 compiler,
or
use 5.0 or 6.0 compiler with "-lF77"
f90 -c quadratic.f90
f90 -o quad quadratic.o
which may be combined as
f90 -o quad quadratic.f90
Static Linking:
Here the NAg library is statically-linked (.a) in:
f90 -o nag_ex nag_example.f90 -lnag
- -lnag statically links with libnag.a;
- there are still dynamic dependencies (use ldd to see this);
f90 -Bstatic -o nag_ex nag_example.f90 -lnag
ensures all libraries are statically-linked.
Dynamic Linking
f90 -o quad quadratic.o /software/nag/naglib_f77_mark19/libnag.so.19
Dynamic vs Static Linking
- dynamically-linked executables are smaller;
- statically-linked executables may load faster and are more portable.
About this document:
Produced from the SGML: /home/isd/public_html/_course_fortran_90/_reml_grp/index.reml
On: 10/2/2003 at 10:33:52
Options: reml2 -i noindex -l long -o html -p multiple