2.9. Examples of gnatbind Usage

This section contains a number of examples of using the XGC Ada binding utility gnatbind.

gnatbind hello.ali

The main program Hello (source program in hello.adb) is bound using the standard switch settings. The generated main program is b_hello.c. This is the normal, default use of the binder.

gnatbind main.ali -o mainprog.c -x -e

The main program Main (source program in main.adb) is bound, excluding source files from the consistency checking, generating the file mainprog.c.

gnatbind -x main_program.ali -o mainprog.c

This command is exactly the same as the previous example. Switches may appear anywhere in the command line, and single letter switches may be combined into a single switch.

gnatbind -n math.ali dbase.ali -o ada-control.c

The main program is in a language other than Ada, but calls to subprograms in packages Math and Dbase appear. This call to gnatbind generates the file control.c containing the adainit and adafinal routines to be called before and after accessing the Ada subprograms.