HPlogo ALLBASE/SQL FORTRAN Application Programming Guide: HP 9000 Computer Systems > Chapter 1 Getting Started with ALLBASE/SQL Programming in FORTRAN

The Compiler and the Linker

» 

Technical documentation

» Feedback

 » Table of Contents

 » Index

Figure 1-4 “Compile-Time and Link-Time Events” summarizes the steps in creating an executable ALLBASE/SQL FORTRAN program from the files created by the FORTRAN preprocessor.

Figure 1-4 Compile-Time and Link-Time Events

[Compile-Time and Link-Time Events]

You submit to the FORTRAN compiler a modified source code file and the related include file(s) created by the preprocessor. The compiler then generates an object code file. By default, any object code file has a .o file extension. To convert one or more object code files into an executable program, you link them by invoking the linker. This step creates an executable program file. Refer to the Chapter "Using the ALLBASE/SQL FORTRAN Preprocessor" for more information on compiling and linking.

To convert these object code files into an executable program, link them after compilation by invoking the HP-UX linker. This step creates an executable program file. The linker is automatically invoked after compilation unless the -c compile only option is used.

If you want to link multiple object code modules together to form one executable program, list the object code modules following the FORTRAN compiler command, followed by the library options. If each of the object code modules has a .o file extension, the module will not be recompiled. If you do not use the -o compiler option to specify a specific output file name for the linked output, a file named a.out is created by default.

In the following example, an executable program named someprog.r is created after the FORTRAN preprocessor stores a module, somemod, in a DBEnvironment, somedbe:

   login: pgmr1

    .

    .

   $ psqlfor somedbe -m somemod -i mysource.sql -p mysource.f

    .

    .

   $ fc mysource.c -lsql -lcl -lportnls -o someprog.r

The options used are:

  • -lsql, to link the ALLBASE/SQL runtime library, in /usr/lib/libsql.a.

  • -lcl, to link the Pascal runtime library, in /usr/lib/libcl.a.

  • -lportnls, to link the native language routines, in /usr/lib/libprotnls.a.

  • -o, to create the executable output file someprog.r

300/400:

Compiler command options differ for Series 300 Series 400 systems.

   login: pgmr1

    .

    .

   $ psqlfor somedbe -m somemod -i mysource.sql -p mysource.f

    .

    .

   $ fc mysource.f -lsql -lheap2 -lportnls -lpc -o someprog.r

The options used are:

  • -lsql, to link the ALLBASE/SQL runtime library, in /usr/lib/libsql.a.

  • -lheap2, to link the heap managemnet routines, in /usr/lib/libheap2.a.

  • -lportnls, to link the native language routines, in /usr/lib/libprotnls.a.

  • -lpc, to link the Pascal runtime library, in /usr/lib/libpc.a

  • -o, to create the executable output file someprog.r