comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Gnat: system__finalization_implementation__finalize_list
Date: Thu, 30 Jan 2003 20:09:31 GMT
Date: 2003-01-30T20:09:31+00:00	[thread overview]
Message-ID: <wccy952jt6s.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: uadhiwook.fsf@nasa.gov

Stephen Leake <Stephen.A.Leake@nasa.gov> writes:

> porton@ex-code.com (Victor Porton) writes:
> 
> > (1) I compiled my program whose effectively main rountine is not a 
> > procedure but a begin...end block of a package specifically designed to 
> > be used as the main rountine. It is perfectly legal accordingly ARM
> 
> I could not find the reference that supports this; can you quote it?

Mr. Porton is correct: the main subprogram is optional in Ada 95.
This means that every Ada implementation must support programs
(partitions, actually) that have no main subprogram.

In Ada 83, a main subprogam was required (but it was confusingly called
the "main program").  Since most Ada compilers require the main
subprogram to be a procedure, not a function, I usually call the "main
procedure".

"Main routine" is not Ada jargon -- I suppose Mr. Porton can reasonably
use it to refer to a package body, if he likes.

The reasons for making main subprograms optional in Ada 95 were:
There are some programs that do all their work in library level tasks;
it seems silly to make them write a main subprogram with a "null;"
statement.  Annex E defines the notion of "shared passive partitions",
for which it was thought that main subprograms make no sense.
If you're trying to link some Ada code with some other language, where
the other language gets control first, then it makes no sense to have a
main subprogram on the Ada side.

> I don't see how it can arrange to call 'adainit' and 'adafinal' in
> this case. That is probably your problem.

Adainit is called *before* the main subprogram (if any), and adafinal
*after*.  If there's no main subprogram, that has no effect on when
adainit and adafinal get called.  If it's an all-Ada program, they get
called automatically; if it's a C program with some Ada inside, then the
C code had better call adainit and adafinal "by hand".

> Try it with a normal 'main procedure', just for kicks.

Shouldn't matter.

- Bob



  reply	other threads:[~2003-01-30 20:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-29  8:23 Gnat: system__finalization_implementation__finalize_list Victor Porton
2003-01-29  9:02 ` Victor Porton
2003-01-29 19:45 ` Stephen Leake
2003-01-29 23:35 ` Victor Porton
2003-01-30  0:28   ` Bill Findlay
2003-01-30  7:50   ` Wojtek Narczynski
2003-01-30 17:07   ` Stephen Leake
2003-01-30  4:28 ` Victor Porton
2003-01-30 17:08   ` Stephen Leake
2003-01-30 20:09     ` Robert A Duff [this message]
2003-01-31 10:17       ` Alexander Boucke
2003-01-31 22:11         ` Simon Wright
2003-01-30 20:38 ` Simon Wright
2003-01-31  3:19 ` Victor Porton
replies disabled

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