2.8. Search Paths for gnatbind

The binder takes the name of an ALI file as its argument and needs to locate source files as well as other ALI files to verify object consistency.

For source files, it follows exactly the same search rules as gcc (see Section 1.3). For ALI files the directories searched are:

  1. The directory containing the ALI file named in the command line, unless the switch -I- is specified.

  2. All directories specified by -I switches on the gnatbind command line, in the order given.

  3. Each of the directories listed in the value of the ADA_OBJECTS_PATH environment variable. Construct this value the same as the PATH environment variable: a list of directory names separated by colons.

  4. The default location for the XGC Ada Run-Time Library (RTL) files, determined when XGC Ada was built and installed on your system.

In the binder the switch -I is used to specify both source and library file paths. Use -aI instead if you just want to specify source paths only and -aO if you want to specify library paths only. This means that for the binder -Idir is equivalent to -aIdir \-aO\/OBJECT_SEARCH=dir. The binder generates the bind file (a C language source file) in the current working directory.

The packages Ada, System, and Interfaces and their children make up the XGC Ada Run-Time Library, together with the package XGC Ada and its children which contain a set of useful additional library functions provided by XGC Ada. The sources for these units are needed by the compiler and are kept together in one directory. The ALI files and object files generated by compiling the RTL are needed by the binder and the linker and are kept together in one directory, typically different from the directory containing the sources. In a normal installation, you need not specify these directory names when compiling or binding. Either the environment variables or the built-in defaults cause these files to be found.

Besides the assistance in using the RTL, a major use of search paths is in compiling sources from multiple directories. This can make development environments much more flexible.