From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,575dfcf6488662de X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Libraries written in Ada Date: Tue, 23 Nov 2004 10:48:45 +0100 Organization: None Message-ID: <1966293.u6rVSTIjq0@linux1.krischik.com> References: <18687975.p80OmDsB1I@linux1.krischik.com> <1464020.dFWPVBaaRG@linux1.krischik.com> Reply-To: martin@krischik.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1101205952 00 27156 KAc2XeFr5Af8siK 041123 10:32:32 X-Complaints-To: usenet-abuse@t-online.de X-ID: Tlcc7kZcreHY43TEWGczMIN3ZTuvvKLQDOiSIAYXRIEAMt5CmdyD0u User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:6362 Date: 2004-11-23T10:48:45+01:00 List-Id: 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