From: Martin Krischik <martin@krischik.com>
Subject: Re: Libraries written in Ada
Date: Tue, 23 Nov 2004 13:36:02 +0100
Date: 2004-11-23T13:36:02+01:00 [thread overview]
Message-ID: <29776258.sBDdEVhOhy@linux1.krischik.com> (raw)
In-Reply-To: pan.2004.11.23.11.03.08.551267@ID-174572.user.uni-berlin.de
Thomas Lotze wrote:
> On Tue, 23 Nov 2004 10:48:45 +0100, Martin Krischik wrote:
>
>> can be preelaborated by the compiler and then no runtime elaboration is
>> needed.
>
> How can I find out whether the code produced by the compiler (not a
> specific one, but any compiler that conforms to the spec) needs runtime
> elaboration? Are there simple rules such as "this code pattern may or does
> require runtime elaboration while that pattern can be safely assumed to
> work without"? I'd have to dig further through the references, but I
> haven't found a clear statement so far.
You can restrict packages to not use specific elaboations:
pragma Pure ();
pragma Preelaboreate ();
The pragmas are for the Annex E where these things are more important than
in normal development.
>> 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.
>
> So it's not possible to reset a package in the midst of program execution?
> If so, is it a conscious design decision, and what's the rationale? (The
> solution seems to be offering reset functionality in the package.)
A conscious design decision:
package
Test
is
Y : constant Integer = X (...);
end Test;
Do I have to explain it or do you spot it yourself ;-) .
>> Ada95 is a object orientated language with some form
>> contructor/descructor system called controled objects. adafinal () will
>> call the finalisation for static controled objects.
>
> What if a package doesn't have any specific finalization code? Is there
> some generic stuff that must always be run, or can finalization be omitted
> in such a case?
With GNAT the binder will automaticly generate the needed code just like
with adainit ().
The code generated by the binder is stored in some b~ file. It is a normal
Ada source code. In Ada only programms the binder output is deleted
imediatly after linking - in mixed language development the binder output
is not deleted. More over: you can choose Ada or C as bind language -
whatever suits you best.
BTW: That's where I got my knowledge from: I did make an Ada library for use
with C (http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/adacl/CUnicode) and
had more then one good look at the binder output.
And to be honest: While it is possible to write Ada code that does not need
any init or term - you won't have much fun doing so. i.E.
package Interface.C is Pure but
package Interface.C.Strings is only Preelaborate and
package Ada.Text_IO is unmarked.
And if a package is unmarked then you have to expect both init and term.
With Regards
Martin
--
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com
next prev parent reply other threads:[~2004-11-23 12:36 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
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 [this message]
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