Figure 43–8. openLibrary
PROCEDURE openLibrary (STRING fileName;
OPTIONAL BITS ctrlBits;
PRODUCES OPTIONAL STRING msg);
openLibrary opens the MAINSAIL objmod library file named fileName. After the library has been opened, it takes place in executable objmod searches (see Chapter 14). The only valid ctrlBits bit is errorOK. If errorOK is set, FALSE is returned if the library cannot be opened; in this case, msg is set to a STRING describing why openLibrary failed. If errorOK is not set and an error occurs, a message is written to logFile, and a new library name read from cmdFile.
Libraries are searched in order from most recently opened to least recently opened. If two libraries contain a MODULE with the same name, the one in the more recently opened library is found by a MODULE search.
An open library file remains open during execution until closeLibrary is called for the library. If the same library name is given to a subsequent call to openLibrary (the name must be exactly the same STRING as was passed to openLibrary when the library was first opened), the library file is not actually opened again; instead, the specified library is moved to the head of the open objmod library list (if more than one open library contains a MODULE with the same name, the MODULE in the library closer to the head of the open objmod library list is the one found by an exeSearch for the MODULE). Library names are compared in a case-sensitive way for this purpose, regardless of the setting of the $fileNamesAreCaseSensitive bit in $attributes.