The use of mapping files is not required for correct operation of the compiler, but mapping files can improve efficiency, particularly when sources are read over a slow network connection. In normal operation, you need not be concerned with the format or use of mapping files, and the `-gnatem' switch is not a switch that you would use explicitly. It is intended primarily for use by automatic tools such as `gnatmake' running under the project file facility. The description here of the format of mapping files is provided for completeness and for possible use by other tools.
A mapping file is a sequence of sets of three lines. In each set, the first line is the unit name, in lower case, with %s appended for specs and %b appended for bodies; the second line is the file name; and the third line is the path name.
main%b main.2.ada /gnat/project1/sources/main.2.ada
When the switch `-gnatem' is specified, the compiler will create in memory the two mappings from the specified file. If there is any problem (nonexistent file, truncated file or duplicate entries), no mapping will be created.
Several `-gnatem' switches may be specified; however, only the last one on the command line will be taken into account.
When using a project file, `gnatmake' creates a temporary mapping file and communicates it to the compiler using this switch.