!TITLE Loader Interface !KEY Note 1. Loader search order. When the loader is asked to find an entry point, the search is done in the following order: 1. System entries i.e. subsystem and Director system call list 2. Privately loaded entries 3. Current active directory 4. Subsystem base directory 5. Privately nominated directories i.e. SEARCHDIR list The subsystem base directory contains pointers to heavily used software such as the standard compilers and mathematical libraries, MAIL, VIEW, SETMODE etc. Object files found via the subsystem base directory are always added to the 'permanently loaded' loader table and remain loaded until the end of the current session or a call of RESETLOADER. Searching is always linear down the search list, never circular. !PAGE Note 2. Searching for entries at command level. If the loader is asked to load a particular command and it could not be found after a full search then the following action is taken. The loader assumes that the command name is really a file name and tries to connect it. If the connect fails or it succeeds but the file is neither an object file nor a character file then the load has failed and the message 'Load fails - ENTRY not found' is output. If the file is an object file then it is examined for a main entry point. If found then the object file is run otherwise the load fails. If the file is a character file, then a call is made to OBEYJOB to obey the contents of the file on the assumption that it contains a series of commands. Note that for an object file with a main entry then Command: PROGY Command: RUN(PROGY) Command: EXECUTE(PROGY) have identical effects at command level. !PAGE Note 3. Return code from non-trappable events in user programs. Just before the loader passes control to a piece of user software, it sets a trap to catch catastrophic failures in that software such as 'unassigned variable', 'address error', etc. If indeed some such contingency does occur in the user program then control passes to the trap. Almost the first thing the loader does is check the return code. If this is still zero, i.e. 'success' - which is quite likely since the failure was presumably unexpected - then the loader itself will set a standard return code of 103050709 before calling the diagnostics package and returning to whatever initiated the unsuccessful call. In many cases the initiating software will be the subsystem itself i.e. a user command typed at command level, but some other routines/commands available in the subsystem and callable from within user programs, themselves set up loader traps. Examples of these are RUN, CALL, EXECUTE (all described below), EMASFC, FCALL and PCALL. If a user program calls on one of these utilities then control will return to the program even after a catastrophic failure. If the program always checks the return code after calling one of these utilities then at least it can detect that a non-trappable failure has occurred and take appropriate action. !PAGE Note 4. Reserved filenames The files T#CODE, T#GLA and T#LOAD are reserved for use by the loader; their use for any other purpose is NOT recommended. ! ! Not wholly contained in DAREA DATASPACE(ASTEROID,DAREA,40,20) => Overlaps STAR DATASPACE(COMET,DAREA,40,40,R) => DAREA already connected in W mode for STAR whereas DATASPACE(RIGEL,DAREA,20,40) would set up a new data entry 20 bytes long from byte 41 to 60 in DAREA while DATASPACE(CASTOR,DAREA,10,60) and DATASPACE(POLLUX,DAREA,10,70) would assign the remaining 20 bytes in the file to data entries CASTOR and POLLUX each 10 bytes long. The important point to remember is that the DATASPACE area length is always given in BYTES. !> !> ! ! ! ! ! ! !> ! !> ! !< Current load status - LOADEDENTRIES, LOADEDFILES, CURRENTREFS !KEY LOADEDENTRIES,LOADEDFILES,CURRENTREFS LOADEDENTRIES prints a list of entries which have been loaded by the caller i.e. no subsystem or system call table entries. LOADEDFILES prints a list of currently loaded files. CURRENTREFS prints out a list of currently active references. An active reference is one which will trigger off a loader search if encountered during a load (unsatisfied reference) or program execution (dynamic reference). !> !> ! ! ! 0 ----------- ENTRY was not found after a complete search(%RESULT=289) or an error condition was encountered. !> !> !> ! ! !0), the routine attempts to satisfy them by searching for, and loading, files which contain any of the outstanding reference names as entry points. Common areas are created where appropriate. The routine terminates on encountering the first failure of any kind and will return a non zero flag. The routine requires the value of the local loadlevel as input. (LOCLL). If everything is to be 'permanently loaded' then LOCLL should be 0 otherwise the overall load level (from CURRENTLL (q.v.)) should be supplied (See Note 2 above). ! !> ! !> !> ! !=LOCLL to be unloaded. When the unload occurs at the end of normal processing then FAIL should be set to 0. However when the call to UNLOAD2 occurs as the result of a failed load then FAIL should be set to 1. This will ensure that any item 'permanently' loaded during the failed load will be unloaded. Note that if there are any references at loadlevels ! ! ! ! !> ! ! !>