Linking Several Relocatable Object Files [ HP Link Editor/XL Reference Manual ] MPE/iX 5.0 Documentation
HP Link Editor/XL Reference Manual
Linking Several Relocatable Object Files
When compiling large programs that consist of several separately compiled
modules, you must execute HP Link Editor/XL directly. It is a good idea
to split a large program into modules because each module can be modified
and recompiled independently. You can use the link editor at any time to
relink the modules, creating a new executable program file.
Figure 2-2 shows the commands that compile and link two HP FORTRAN 77
source files, EX2ASRC and EX2BSRC. The HP FORTRAN 77 compiler produces
the relocatable object files, EX2AOBJ and EX2BOBJ. The :LINK command
creates a new executable program file, EX2PROG, consisting of both
relocatable object files.
___________________________________________________________________
| |
| :FTNXL EX2ASRC,EX2AOBJ |
| :FTNXL EX2BSRC,EX2BOBJ |
| :LINK FROM=EX2AOBJ,EX2BOBJ;TO=EX2PROG |
___________________________________________________________________
Figure 2-2. Linking Two HP FORTRAN 77 Relocatable Object Files
If, after creating the executable program file, you need to update one or
more modules, you must modify and recompile those modules, then relink
all of them. For example, figure 2-3 shows how to recompile the HP
FORTRAN 77 source file, EX2BSRC (which was linked in figure 2-2), and to
recreate the executable program file, EX2PROG. The compile command
(:FTNXL) overwrites the previous contents of EX2BOBJ. EX2AOBJ remains
unchanged from the previous compilation. (Normally it is a good idea
during program development to save relocatable object files. This avoids
having to recompile source files that have not changed.)
___________________________________________________________________
| |
| :FTNXL EX2BSRC,EX2BOBJ |
| :LINK FROM=EX2AOBJ,EX2BOBJ;TO=EX2PROG |
___________________________________________________________________
Figure 2-3. Relinking Two HP FORTRAN 77 Relocatable Object Files
MPE/iX 5.0 Documentation