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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7c47766edd175974 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-01 17:24:28 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!207.217.77.102!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3DC3293C.8040104@acm.org> From: Jeffrey Carter User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How do package body initializers get run in GNU Ada? References: <3DC31EBB.2050809@math.jpl.nasa.gov> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 02 Nov 2002 01:23:34 GMT NNTP-Posting-Host: 63.184.17.114 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1036200214 63.184.17.114 (Fri, 01 Nov 2002 17:23:34 PST) NNTP-Posting-Date: Fri, 01 Nov 2002 17:23:34 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:30301 Date: 2002-11-02T01:23:34+00:00 List-Id: Van Snyder wrote: > > In GNU Ada, what mechanism is used to cause execution of package > body initializers, i.e., the code between begin and end in a > package body? You can find the answer to your question by reading the GNAT sources. > > Is it done using some kind of back-patching/overlaying done > by an otherwise garden-variety ld, by special features added > to ld to support Ada, by first-time flags at the entries > to procedures, or by something else? You will find that the binding process (gnatbind) builds the main program, which makes a call or calls to execute such code before calling your main procedure. By reading the secret GNAT documentation you can find the option that keeps the source of this main program instead of deleting it after the executable is written. You could then look at the main program and see what it calls to effect elaboration. -- Jeff Carter "I fart in your general direction." Monty Python & the Holy Grail