Matching Import and Export Objects
During the linkage process, the system attempts to establish matches between objects imported by the client library and objects exported by the server library. The rules governing this matching are discussed under Methods of Providing Objects and Type Matching.
Missing Objects Might Not Prevent Linkage
Library linkage can proceed successfully even if the system does not find matches for all the import objects. However, the following minimum matches must succeed in order for linkage to take place:
-
If any objects are imported, then at least one object must match for linkage to succeed.
-
If the linkage was initiated implicitly, by accessing 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 server library. The system discontinues the client process.
-
OBJECT <object name> LINKAGE CLASS VIOLATION IN LIBRARY <library name>
The client process lacks the linkage class necessary to use the exported object. The system discontinues the client 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 client 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 client process attempted to import a data object as read-write when the object was exported as read-only. The system discontinues the client process.
Detecting Whether Objects Are Missing
If the LINKLIBRARY function is used to establish the linkage, the return value indicates whether there were any problems in finding object matches.
Checking the Availability of an Object
To prevent the possibility of a fatal error when using an imported object, the client program 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;

