[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
gnatlink
This chapter discusses gnatlink
, a utility program used to link
Ada programs and build an executable file. This is a simple program
that invokes the UNIX linker (via the gnatgcc
command) with a correct list of object files and library references.
gnatlink
automatically determines the list of files and
references for the Ada part of a program. It uses the binder file
generated by the binder to determine this list.
5.1 Running gnatlink
5.2 Switches for gnatlink
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
gnatlink
The form of the gnatlink
command is
$ gnatlink [switches] mainprog[.ali] [non-Ada objects] [linker options] |
`mainprog.ali' references the ALI file of the main program.
The `.ali' extension of this file can be omitted. From this
reference, gnatlink
locates the corresponding binder file
`b~mainprog.adb' and, using the information in this file along
with the list of non-Ada objects and linker options, constructs a UNIX
linker command file to create the executable.
The arguments following `mainprog.ali' are passed to the
linker uninterpreted. They typically include the names of object files
for units written in other languages than Ada and any library references
required to resolve references in any of these foreign language units,
or in pragma Import
statements in any Ada units. This list may
also include linker switches.
gnatlink
determines the list of objects required by the Ada
program and prepends them to the list of objects passed to the linker.
gnatlink
also gathers any arguments set by the use of
pragma Linker_Options
and adds them to the list of arguments
presented to the linker.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
gnatlink
The following switches are available with the gnatlink
utility:
-A
-C
gnatlink
that the binder has generated C code rather than
Ada code.
-g
-g
.
In addition, the binder does not delete the `b~mainprog.adb',
`b~mainprog.o' and `b~mainprog.ali' files.
Without -g
, the binder removes these files by
default. The same procedure apply if a C bind file was generated using
-C
gnatbind
option, in this case the filenames are
`b_mainprog.c' and `b_mainprog.o'.
-n
-v
-v -v
-o exec-name
gnatlink try.ali
creates
an executable called `try'.
-b target
-Bdir
gnat1
, the Ada compiler)
from dir instead of the default location. Only use this switch
when multiple versions of the GNAT compiler are available. See the
gnatgcc
manual page for further details. You would normally use the
-b
or -V
switch instead.
--GCC=compiler_name
gnatgcc
'. You need to use quotes around compiler_name if
compiler_name
contains spaces or other separator characters. As
an example --GCC="foo -x -y"
will instruct gnatlink
to use
foo -x -y
as your compiler. Note that switch -c
is always
inserted after your command name. Thus in the above example the compiler
command that will be used by gnatlink
will be foo -c -x -y
.
--LINK=name
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |