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!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.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 13:36:02 +0100 Organization: None Message-ID: <29776258.sBDdEVhOhy@linux1.krischik.com> References: <18687975.p80OmDsB1I@linux1.krischik.com> <1464020.dFWPVBaaRG@linux1.krischik.com> <1966293.u6rVSTIjq0@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 1101213996 03 758 aHe2X42OMEHXSgIE 041123 12:46:36 X-Complaints-To: usenet-abuse@t-online.de X-ID: ZkJWzQZH8eA8Pp2ANxZqc6e0em8W7jEUev+b5Ryzdk+mP9HbZx67cG User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:6372 Date: 2004-11-23T13:36:02+01:00 List-Id: 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