### 15.1.16 PSECT Directive

The PSECT directive modifies several characteristics of a common block. It takes the following form:

  cDEC$ PSECT /common-name/ a [, a] . . .
  c
  Is one of the following: C (or c), !, or * (see Section 15.1.1).
  common-name
  Is the name of the common block. The slashes ( / ) are required.
  a
  Is one of the following keywords:
  - ALIGN=val or ALIGN=keyword

    Specifies alignment for the common block.

    The val is a constant ranging from 0 through 16 on OpenVMS systems, 0 through 6 on Windows systems, and 0 through 4 on Tru64 UNIX and Linux systems. The specified number is interpreted as a power of 2. The value of the expression is the alignment in bytes.

    The keyword is one of the following:

    Keyword | Equivalent to val
    --- | ---
    BYTE | 0
    WORD | 1
    LONG | 2
    QUAD | 3
    OCTA | 4
    PAGE 1 | Alpha: 16 ia32: 12 ia64: 13
    1 Range for Alpha is 0 to 16; for ia32 and ia64, 0 to 13.

  - GBL (VMS only)

    Specifies global scope.

  - LCL (VMS only)

    Specifies local scope. This keyword is opposite to GBL and cannot appear with it.

  - [NO]MULTILANGUAGE (VMS only)

    Controls whether the compiler pads the size of common blocks to ensure compatibility when the common block program section (psect) is shared by code created by other Compaq compilers.

    When a program section generated by a Fortran common block is overlaid with a program section consisting of a C structure, linker error messages can occur. This is because the sizes of the program sections are inconsistent; the C structure is padded, but the Fortran common block is not.

    Specifying MULTILANGUAGE ensures that Compaq Fortran follows a consistent program section size allocation scheme that works with Compaq C program sections shared across multiple images. Program sections shared in a single image do not have a problem.

    You can use a compiler option to specify MULTILANGUAGE for all common blocks in a module.

  - [NO]SHR (VMS only)

    Determines whether the contents of a common block can be shared by more than one process.

  - [NO]WRT

    Determines whether the contents of a common block can be modified during program execution.

Rules and Behavior

Global or local scope is significant for an image that has more than one cluster. Program sections with the same name that are from different modules in different clusters are placed in separate clusters if local scope is in effect. They are placed in the same cluster if global scope is in effect.

If one program unit changes one or more characteristics of a common block, all other units that reference that common block must also change those characteristics in the same way.

Default characteristics apply if you do not modify them with a PSECT directive. Table 15-1 lists the default characteristics of common blocks and how they can be modified by PSECT.

Table 15-1 Common Block Defaults and PSECT Modification

Default Characteristics | PSECT Modification
--- | ---
Relocatable | None
Overlaid | None
Global Scope | Global or local scope
Not executable | None
Not multilanguage | Multilanguage or not multilanguage
Writable | Writable or not writable
Readable | None
No protection | None
Octaword alignment1 (4) | VMS: 0 through 16 2 WNT and W9*: 0 through 6 3 U*X: 0 through 4 3
On Alpha processors:
Not shareable | Shareable or not shareable
Position dependent | None
On ia32 processors:
Shareable | Shareable or not shareable
Position independent | None
1 An address that is an integral multiple of 16. 2 Or keywords BYTE through PAGE. 3 Or keywords BYTE through OCTA.

For More Information:

- On syntax rules for all general directives, see Section 15.1.1.
- On the default characteristics of common blocks on OpenVMS systems, see the OpenVMS Linker Utility Manual; on U*X systems, see `ld(1)`; on WNT and W9* systems, see the online Help on the linker.
- On compiler options, see your user manual or programmer's guide.

Previous Page Next Page Table of Contents