Next: , Previous: Creating an Ada Library, Up: GNAT and Libraries

18.2 Installing an Ada Library

In the GNAT model, installing a library consists in copying into a specific location the files that make up this library. It is possible to install the sources in a different directory from the other files (ALI, objects, archives) since the source path and the object path can easily be specified separately.

For general purpose libraries, it is possible for the system administrator to put those libraries in the default compiler paths. To achieve this, he must specify their location in the configuration files ada_source_path and ada_object_path that must be located in the GNAT installation tree at the same place as the gcc spec file. The location of the gcc spec file can be determined as follows:

     $ gcc -v

The configuration files mentioned above have simple format: each line in them must contain one unique directory name. Those names are added to the corresponding path in their order of appearance in the file. The names can be either absolute or relative, in the latter case, they are relative to where theses files are located.

ada_source_path and ada_object_path might actually not be present in a GNAT installation, in which case, GNAT will look for its run-time library in he directories adainclude for the sources and adalib for the objects and ALI files. When the files exist, the compiler does not look in adainclude and adalib at all, and thus the ada_source_path file must contain the location for the GNAT run-time sources (which can simply be adainclude). In the same way, the ada_object_path file must contain the location for the GNAT run-time objects (which can simply be adalib).

You can also specify a new default path to the runtime library at compilation time with the switch --RTS=rts-path. You can easily choose and change the runtime you want your program to be compiled with. This switch is recognized by gcc, gnatmake, gnatbind, gnatls, gnatfind and gnatxref.

It is possible to install a library before or after the standard GNAT library, by reordering the lines in the configuration files. In general, a library must be installed before the GNAT library if it redefines any part of it.