Binding with gnatbind (GNAT User’s Guide for Native Platforms)

### 4.5 Binding with `gnatbind` ¶

This chapter describes the GNAT binder, `gnatbind`, which is used to bind compiled GNAT objects.

The `gnatbind` program performs four separate functions:

- Checks that a program is consistent, in accordance with the rules in Chapter 10 of the Ada Reference Manual. In particular, error messages are generated if a program uses inconsistent versions of a given unit.
- Checks that an acceptable order of elaboration exists for the program and issues an error message if it cannot find an order of elaboration that satisfies the rules in Chapter 10 of the Ada Language Manual.
- Generates a main program incorporating the given elaboration order. This program is a small Ada package (body and spec) that must be subsequently compiled using the GNAT compiler. The necessary compilation step is usually performed automatically by `gnatlink`. The two most important functions of this program are to call the elaboration routines of units in an appropriate order and to call the main program.
- Determines the set of object files required by the given main program. This information is output in the forms of comments in the generated program, to be read by the `gnatlink` utility used to link the Ada application.