previous next top complete contents complete index framed top this page unframed
The MAINSAIL compiler, by default, outputs the executable form of a MAINSAIL MODULE into a file (an objmod file) of which the name is formed from the name of the MODULE compiled.
Intmods are not executable. They contain information used during compilation of other MODULEs or used by MAINSAIL system programs. See Chapter 13 for more details.
Both objmods and intmods may be stored into libraries, which are files containing several MODULEs. Objmods are stored into objmod libraries, and intmods into intmod libraries; either type of library may be referred to as a MODULE library. MODULEs may be compiled directly into MODULE libraries (see Section 4.27 of the MAINSAIL Compiler User's Guide) or added to MODULE libraries with the utilities MODLIB (see Chapter 24 of the MAINSAIL Utilities User's Guide) and INTLIB (see Chapter 18 of the MAINSAIL Utilities User's Guide).
MAINSAIL may execute MODULEs from objmod files or from objmod libraries. Objmod libraries have several advantages over individual objmod files:
More information on MODULE libraries may be found in Chapter 24 of the MAINSAIL Utilities User's Guide.
14.1. Objmod and Intmod File Names
The default intmod file name as output by the compiler has the form:
targetOSSpecificAbbreviation-int:moduleName
where the target-OS-specific abbreviation is either $systemNameAbbreviation or the first 3 characters of $systemNameAbbreviation, depending on the operating system (consult the relevant part of the MAINSAIL System-Specific User's Guides to determine which is used on the operating system you are interested in). This abbreviation is known as the file abbreviation for the target operating system (it can be determined within a program by calling $targetSystemBaseFileNameSuffix).
For example, a MODULE FOO compiled for a RISC System/6000 UNIX system (where $systemNameAbbreviation is uirs and the file abbreviation is uir) is compiled into an intmod file named uir-int:foo. A searchpath is usually set up for intmod file names. Bootstraps distributed by XIDAK specify a searchpath (see Section 21.2.35 of the MAINSAIL Utilities User's Guide for a description of the MAINEX SEARCHPATH subcommand) of the form:
SEARCHPATH *-int:* *2-*1.int
unless otherwise noted in the relevant part of the MAINSAIL System-Specific User's Guides. This searchpath would map uir-int:foo into foo-uir.int, where the intmod for FOO would be stored.
The default objmod file name as output by the compiler has the form:
targetOSSpecificAbbreviation-obj:moduleName
where the target-OS-specific abbreviation is the file abbreviation for the target operating system. For example, a MODULE BAR compiled for a SPARC UNIX system (where $systemNameAbbreviation is uspa and the file abbreviation is usp) is compiled into an objmod file named usp-obj:bar. A searchpath is usually set up for objmod file names. Bootstraps distributed by XIDAK specify a searchpath of the form:
SEARCHPATH *-obj:* *2-*1.obj
unless otherwise noted in the relevant part of the MAINSAIL System-Specific User's Guides. This searchpath would map usp-obj:bar into bar-usp.obj, where the objmod for BAR would be stored.
These file names and searchpaths are subject to change;
those shown are correct for the current release,
unless otherwise documented in the
relevant part of the MAINSAIL System-Specific User's Guides.
14.2. Objmod and Intmod Search Rules
There are three types of searches that MAINSAIL makes to find an
intmod or objmod:
A search is always for a particular target system. For example, an executable search is always for the host system. A cross-compilation requires intmods and objmods for the system for which the compilation is done.
The distinction between objmod searches and executable searches allows one version of an objmod to be executing while another version (possibly for a different target system) is used for another purpose, such as incremental recompilation.
By default, all searches first look in all open libraries (intlibs for intmods, objlibs for objmods), more recently opened libraries first, and then try to open a file with the default name, as described in Section 14.1. This search order may be reversed with the MAINEX INTFILE, OBJFILE, or EXEFILE subcommand (see below and Section 21.2.2 of the MAINSAIL Utilities User's Guide). The MAINSAIL system objlib is initially open for exeSearches.
An unsuccessful library search is always immediately followed by a foreign MODULE search in the case of exeSearches. The foreign MODULE table is constructed with the aid of the Foreign Language Interface; see Chapter 7 of the MAINSAIL Compiler User's Guide.
Each type of search is governed by a separate list:
Each entry on one of these lists indicates that a particular intmod or objmod is to be found in a particular file or library (or that the objmod is really another objmod, in the case of the MODULE-to-MODULE association list). The lists are empty unless an entry is specifically created (normally by a MAINEX subcommand, or by a MAINEX subcommand passed to $getSubcommands). In the absence of any entries, a default search occurs, which is often sufficient; the lists are used only to indicate exceptions to the default search mechanism. If a list indicates that a MODULE is in a particular library, then when a search is made for that MODULE, the indicated library is automatically opened if necessary.
Each entry on the lists contains the following information:
An exeSearch first checks the MODULE-to-MODULE-association list, as made by calling the PROCEDURE setModName (see Section 47.20) from a MAINSAIL MODULE or by specifying the MAINEX SETMODULE subcommand (see Section 21.2.37 of the MAINSAIL Utilities User's Guide). After the MODULE-to-MODULE substitution is made, if any, an exeSearch behaves like the other two types of search (there is no equivalent of the MODULE-to-MODULE association list for intSearches and objSearches). Each type of search checks its list to see whether the target MODULE has an entry (for the target system), and if so, insists on finding the intmod or objmod in the file or library specified by the entry. A list can have at most one entry with a given MODULE name and target system.
For each type of search, MAINEX subcommands are provided to add an entry to the list, remove an entry from the list, print (part of) the list, and to alter the normal order of search (libraries before files or vice versa). These subcommands are described in detail in Chapter 21 of the MAINSAIL Utilities User's Guide; here is a summary:
| Command | Arguments | Description |
|---|---|---|
| INTFILE | m{=f} ... | intSearch: get m's intmod from file f |
| OBJFILE | m{=f} ... | objSearch: get m's objmod from file f |
| EXEFILE | m{=f} ... | exeSearch: get m's objmod from file f |
| INTLIB | m{=f} ... | intSearch: get m's intmod from intlib f |
| OBJLIB | m{=f} ... | objSearch: get m's objmod from objlib f |
| EXELIB | m{=f} ... | exeSearch: get m's objmod from objlib f |
| INTDEFAULT | m ... | intSearch: default search for m's intmod |
| OBJDEFAULT | m ... | objSearch: default search for m's objmod |
| EXEDEFAULT | m ... | exeSearch: default search for m's objmod |
| INTSHOW | {m ...} | show entries {for m ...} in intList |
| OBJSHOW | {m ...} | show entries {for m ...} in objList |
| EXESHOW | {m ...} | show entries {for m ...} in exeList |
| INTFILE | none | intSearch: search files before intlibs |
| OBJFILE | none | objSearch: search files before objlibs |
| EXEFILE | none | exeSearch: search files before objlibs |
| INTLIB | none | intSearch: search intlibs before files |
| OBJLIB | none | objSearch: search objlibs before files |
| EXELIB | none | exeSearch: search objlibs before files |
By giving the following MAINEX commands with no arguments:
INTFILE
OBJFILE
EXEFILE
you can reverse the default search order, i.e., cause individual files to be searched before open libraries.
The search rules are complicated by the possible use of setModName and subcommands that specify search rules for individual MODULEs, but such individualized searches are often not needed.
MAINSAIL Language Manual, Chapter 14