Introduction to Stand-alone Libraries (GNAT User’s Guide for Native Platforms)

#### 3.9.3.1 Introduction to Stand-alone Libraries ¶

A Stand-alone Library (abbreviated ‘SAL’) is a library that contains the necessary code to elaborate the Ada units that are included in the library. In contrast with an ordinary library, which consists of all sources, objects and `ALI` files of the library, a SAL may specify a restricted subset of compilation units to serve as a library interface. In this case, the fully self-sufficient set of files will normally consist of an objects archive, the sources of interface units’ specs, and the `ALI` files of interface units. If an interface spec contains a generic unit or an inlined subprogram, you must also provide the body’s source; if the units that must be provided in the source form depend on other units, you must also provide the source and `ALI` files of those units.

The main purpose of a SAL is to minimize the recompilation overhead of client applications when a new version of the library is installed. Specifically, if the interface sources have not changed, client applications don’t need to be recompiled. If, furthermore, a SAL is provided in the shared form and its version, controlled by `Library_Version` attribute, is not changed, the clients also do not need to be relinked.

SALs also allow the library providers to minimize the amount of library source text exposed to the clients. Such ‘information hiding’ might be useful or necessary for various reasons.

Stand-alone libraries are also well suited to be used in an executable whose main routine is not written in Ada.