comp.lang.ada
 help / color / mirror / Atom feed
* Using GNAT with a non-Ada main program
@ 1996-03-28  0:00 Robert Dewar
  0 siblings, 0 replies; only message in thread
From: Robert Dewar @ 1996-03-28  0:00 UTC (permalink / raw)


This question was raised recently, and it is definitely true that the
temporary documentation in gnatinfo.txt is inadequate. This is fully
described in the SGI documentation, but of course many people do not
have access to this (although as Tom pointed out, SGI does make this
available on the Web).

Anyway, here are the details.

First compile all the Ada units. One way to do this is with a series
of gnatmake calls:

gnatmake -c unit
gnatmake -c unit

where unit are the Ada units to be accessed from the other language
main program (or its subroutines). 

the -c says compile only, since we don't want gnatmake doing any
binding or linking yet.

now do the bind

gnatbind -n unit1.ali unit2.ali unit3.ali ....

The -n says no Ada main program, and in the general case, you want to 
mention multiple Ada unit names, since the other-language main program
may reference multiple ada units. You only need to include the directly
called units here, not the indirectly called ones, since the normal
closure processing of the binder will get all those.

The bind file created contains the adainit() routine as described in the
RM. It is named for the first unit in the gnatbind list, so the final
link looks like

gnatbl -linkonly unit1.ali main.o x.o y.o

where the o files are for the other-language main program and its routines.
You may want to ue the -o switch to clearly provide a name for the resulting
executable.






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-03-28  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-03-28  0:00 Using GNAT with a non-Ada main program Robert Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox