As part of the linkage process resulting from a LINKLIBRARY request, the system checks to see whether the objects imported and exported by the requesting library and the responding library match up.
Missing Objects during Linkage
Ideally, for each object imported by one library, an exported object of the same name should be declared by the other library. However, library linkage can succeed even if the system does not find matches for some of the imported and exported objects. The following minimum object matches must succeed in order for linkage to take place:
-
If any objects are imported on either side, then a minimum of one object must match.
-
If the linkage was initiated implicitly, by invoking an import object in an unlinked library, then a match must be found for that particular import object.
Error When Missing Object Is Used
The system returns an error for a missing object when that object is first used. (In the case of implicit linkage, these errors can occur at linkage time if they apply to the object whose usage caused the implicit linkage.)
The following are the errors that the system can return:
-
MISSING OBJECT <object name> IN LIBRARY <library name>
No object with the requested name is exported by the matching library. The system discontinues the importing process.
-
OBJECT <object name> LINKAGE CLASS VIOLATION IN LIBRARY <library name>
The importing process lacks the linkage class necessary to use the exported object. The system discontinues the importing process.
-
Object <procedure name>: Type or parameter mismatch in interface <client library identifier> to library <library name>
An export object with the requested name exists, but the type or parameters of the import and export objects do not match. The system discontinues the importing process. For an explanation of the rules used to match object types and parameters, refer to Type Matching later in this section.
-
OBJECT <object name> ACCESS MODE MISMATCH
A process attempted to import a data object as read-write when the object was exported as read-only. The system discontinues the importing process.
Checking the Availability of an Object
To prevent the possibility of a fatal error when using an imported object, the library can use the ISVALID function in ALGOL or NEWP. The ISVALID function returns a Boolean result indicating whether a given object is valid. For example, the following statement invokes procedure PROC1 only if that procedure is valid:
IF ISVALID(PROC1) THEN PROC1;
For imported data, the ISVALID function can check whether the data is available for reading or for reading and writing. The following statement reads integer J if it is available, regardless of whether the access mode is read-only or read-write:
IF ISVALID(J) THEN I := J;
The following statement writes to integer J if it is available and the access mode is read-write.
IF ISVALID(J, READWRITE) THEN J := 43;

