LIBRARY Declaration

The LIBRARY declaration declares a library identifier and specifies values for the library attributes associated with the library. The library identifier can be used by a program to access entry points in the library.

<library declaration>

            ┌◄─────────── , ──────────┐
── LIBRARY ─┴─<library specification>─┴────────────────────────────────┤

<library specification>

──<identifier>─┬────────────────────────────────────────┬──────────────►
               └─ (<library attribute specifications>) ─┘
►─┬───────────────────────────────────┬────────────────────────────────┤
  └─<library object declaration list>─┘

<library object declaration list>

      ┌◄───────────── ; ─────────────┐
── [ ─┴─<library object declaration>─┴─ ] ─────────────────────────────┤

<library object declaration>

──┬─<procedure reference array specification>─┬────────────────────────┤
  └─<imported data specification>─────────────┘

<procedure reference array specification>

──<procedure reference array declaration>──────────────────────────────►
►─┬─────────────────────────────┬──────────────────────────────────────┤
  └─<library object attributes>─┘

<library identifier>

An identifier that is associated with a library in a LIBRARY declaration.

The LIBRARY declaration appears in a program that accesses a library. The LIBRARY declaration can be used to assign values to the library attributes of a library. In a program that calls a library, the library identifier also appears in the PROCEDURE declarations for the library entry points.

Libraries can be declared in any block of a user program. The library and its entry points are valid within the scope of the block; when the block is exited, the linkage to the library is broken, and the count of the library users is decremented.

The <imported data specification> portion of the LIBRARY declaration is identical to the <imported data specification> portion of the IMPORTED declaration.

An imported access mode can be given to a data library object by specifying a <library object access mode> as part of the <library object attributes> variable item. For more information on library object attributes, including compile-time restrictions, see the IMPORTED declaration earlier in this section.

The ALGOL compiler does not allow an access mode to be specified for a procedure, a procedure reference array, an event, an event array, an interlock, or an interlock array.

Library Facility contains extended examples of libraries and programs that use libraries, as well as information about library attributes, library linkage, and library usage in general.

Programs that declare procedure reference arrays as library objects cannot be used for binding.