Importing Data to Client Programs

Server libraries written in ALGOL or NEWP can export data objects, as discussed under Exported Data in Server Libraries earlier in this section. Client programs written in ALGOL can import these data objects by listing them in the LIBRARY declaration. (NEWP does not yet support the importing of data objects by client programs.)

Syntax for Importing Data

For example, the following ALGOL library declaration specifies several imported data items (M, N, G, and E):

LIBRARY L(LIBACCESS = BYFUNCTION, FUNCTIONNAME = “MYSUPPORT”)
   [ INTEGER M (READWRITE),
             N (READONLY);
     ARRAY G[0] (ACTUALNAME = “GG”),
           E[0]  ];

Matching Access Modes

The client program can specify whether each imported data item is read-only or read-write. The default access mode is read-only.

The server library also specifies the access mode for exported data. The following table shows the actual access modes resulting from the possible combinations of values:

Exported Access Mode

Imported Access Mode

Resulting Access Mode

READONLY or unspecified

READONLY or unspecified

READONLY

READONLY or unspecified

READWRITE

Objects cannot match.

READWRITE

READONLY or unspecified

READONLY

READWRITE

READWRITE

READWRITE

If the import and export objects do not match due to conflicting access modes, library linkage can still complete successfully. The LINKLIBRARY result indicates that some requested objects were not available. If the client process attempts to use the imported data object, the client process is discontinued with the error message “OBJECT <object name> ACCESS MODE MISMATCH.” The client process can prevent this error by checking the availability of the data object with the ISVALID function as described under Matching Client and Server Library Objects later in this section.

Data Type Matching

The exported data object and the imported data objects must be of the same or compatible types. Refer to Matching Data Types later in this section.

Limitations on Events

If a client library imports an EVENT or EVENT ARRAY, the client library must explicitly specify an access mode of READWRITE, or a syntax error results.

Exported events can be used in the same ways as any other event. Refer to the topic “Limitations on Events” in “Exported Data in Server Libraries” Exported Data in Server Libraries discussed earlier in this section.

If a program violates one of these restrictions, a syntax error results.