HP Fortran Programmer's Guide (B3908-90031; September 2011)

Compiling and linking
Special-purpose compilations
Chapter 290
A PA-RISC processor name—for example, PA7100 or PA8000.
portable—code that is compatible across all models. Use +DAportable only if you want to ensure
that your program will run on different models.
Use the uname -m command to learn the model of your machine, as follows:
$ uname -m
9000/879
Alternatively, you can use the grep command to look up the model number in the file
/opt/langtools/lib/sched.models and find its architecture type, as follows:
$ grep 879 /opt/langtools/lib/sched.models
879 2.0 PA8000
You can also use the +DSmodel option to specify an architecture-specific instruction scheduler, where
model has the same meaning as it does for the +DA option. Like the +DA option, the +DS option is
unnecessary if the program will run on the same machine as you use to compile it. Also, if you compile with
+DAmodel, the compiler will select the scheduling algorithm based on the same architecture—unless you
use the +DS option to specify a different architecture.
NOTE Code generated for PA1.1 systems will execute on PA2.0 systems, but the reverse is not
true: the loader will not allow PA2.0 code to run on a PA1.1 system.
Creating shared libraries
As mentioned in “Linking to shared libraries” on page 83, many of the HP-UX as well as
HP Fortran libraries are available in shared as well as archive versions. Linking with shared libraries can
make the executable program smaller and can ensure that it always has the most current version of the
library.
You can make shared versions of your own libraries, using the +pic command-line option and the -b linker
option. The following sections describe how to use these options and show an example of how to create a
shared library.
Compiling with +pic
The +pic option causes the compiler to generate Position- Independent Code (PIC) for use in a shared
library. PIC contains no absolute addresses and can therefore be placed anywhere in a process’s address
space without addresses having to be relocated. This characteristic of PIC makes it shareable by multiple
processes.
The syntax of the +pic option is:
+pic={short|long|no}