From: Martin Krischik <martin@krischik.com>
Subject: Re: Libraries written in Ada
Date: Tue, 23 Nov 2004 10:48:45 +0100
Date: 2004-11-23T10:48:45+01:00 [thread overview]
Message-ID: <1966293.u6rVSTIjq0@linux1.krischik.com> (raw)
In-Reply-To: pan.2004.11.22.20.36.14.171291@ID-174572.user.uni-berlin.de
Thomas Lotze wrote:
> On Mon, 22 Nov 2004 18:59:16 +0100, Martin Krischik wrote:
>
>> Actually both. The common runtime consists of packages as well and every
>> package may or may not have it's own mini runtime environment. There are
>> pragma instructions to controll that i.E. "pragma Pure" says that a
>> package has no runtime environment and does not use another package with
>> a runtime environment.
>
> And even though it is thus possible to have an Ada package which doesn't
> need a runtime environment, it is always necessary to initialize one? Is
> that what you meant by "it's not an optional extra" in one of your
> earlier messages?
Consider the following package:
package body
Test
is
Y : Integer;
procedure X
is
begin
Y := 1;
end X;
begin
X;
end Test;
In this case "Y" is the runtime environment and unless you have activated
very agressive optimization the procedure X need to called at package
elaboration.
Of corse:
package body
Test
is
Y : Integer := 1;
end Test;
can be preelaborated by the compiler and then no runtime elaboration is
needed.
>> Please Note: you are asking very low level questions. Normaly you don't
>> need to worry about it. Ada as a package orientated language has it all
>> build.
> Sure, but I'd like to know what implications my choice of language has for
> using the library I want to write before I lean back and feel happy about
> leaving these details to the language.
If you like low leve: I the excample above the GNAT compiler will create a
"package X init" procedure and a Boolean "package X initilized" (I could
find out the actual names - but I don't think it is needed). adainit ()
will check the boolean and call procedure when needed.
>> That's the normal way for static linking. It does have the advantage that
>> the binder will bind and elaborate only the packages which are actually
>> used.
> Nice.
> Thanks for your explanations so far. One thing I haven't thought about
> asking yet: What does adafinal() normally do? Does it things like flushing
> file buffers and closing files, or is it just about cleaning up memory?
> So, if it is the last function called from main(), may it just as well be
> omitted?
Ada95 is a object orientated language with some form contructor/descructor
system called controled objects. adafinal () will call the finalisation for
static controled objects.
With Regards
Martin
--
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com
next prev parent reply other threads:[~2004-11-23 9:48 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-22 11:32 Libraries written in Ada Thomas Lotze
2004-11-22 15:58 ` Martin Krischik
2004-11-22 16:28 ` Thomas Lotze
2004-11-22 16:46 ` Alex R. Mosteo
2004-11-22 19:09 ` Pascal Obry
2004-11-23 11:12 ` Alex R. Mosteo
2004-11-22 17:59 ` Martin Krischik
2004-11-22 20:36 ` Thomas Lotze
2004-11-22 21:25 ` Georg Bauhaus
2004-11-22 21:45 ` Thomas Lotze
2004-11-22 22:07 ` Georg Bauhaus
2004-11-22 22:27 ` Thomas Lotze
2004-11-23 9:54 ` Adrien Plisson
2004-11-23 9:55 ` Martin Krischik
2004-11-23 9:55 ` Martin Krischik
2004-11-23 9:48 ` Martin Krischik [this message]
2004-11-23 11:03 ` Thomas Lotze
2004-11-23 11:38 ` Alex R. Mosteo
2004-11-23 12:22 ` Georg Bauhaus
2004-11-23 13:20 ` Alex R. Mosteo
2004-11-23 13:40 ` Alex R. Mosteo
2004-11-23 12:36 ` Martin Krischik
2004-11-23 13:53 ` Thomas Lotze
2004-11-23 18:39 ` Jeffrey Carter
2004-11-22 20:45 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox