www.delorie.com/gnu/docs/gcc/gnat_ug_72.html   search  
 
Buy the book!


Untitled Document

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.12 Examples of gnatbind Usage

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

gnatbind hello
The main program Hello (source program in `hello.adb') is bound using the standard switch settings. The generated main program is `b~hello.adb'. This is the normal, default use of the binder.

gnatbind hello -o mainprog.adb
The main program Hello (source program in `hello.adb') is bound using the standard switch settings. The generated main program is `mainprog.adb' with the associated spec in `mainprog.ads'. Note that you must specify the body here not the spec, in the case where the output is in Ada. Note that if this option is used, then linking must be done manually, since gnatlink will not be able to find the generated file.

gnatbind main -C -o mainprog.c -x
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 -C -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 dbase -C -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 `ada-control.c' containing the adainit and adafinal routines to be called before and after accessing the Ada units.


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003