You build a program that contains some Ada files and some other language files in one of two ways, depending on whether the main program is in Ada or not. If the main program is in Ada, you proceed as follows:
Compile the Ada units to produce a set of object files and ALI files.
Compile the other language files to generate object files.
Run the Ada binder on the Ada main program.
Compile the Ada main program.
Link the Ada main program, Ada objects and other language objects.
If the main program is in some language other than Ada, you use a special option of the binder to generate callable routines to initialize and finalize the Ada units. You must insert calls to these routines in the main program, or some other appropriate point. The call to initialize the Ada units must occur before the first Ada subprogram is called, and the call to finalize the Ada units must occur after the last Ada subprogram returns. You use the same procedure for building the program as described previously. In this case, however, the binder places the initialization and finalization subprograms into file b_xxx.c instead of the main program.