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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!feeder.erje.net!eu.feeder.erje.net!news.roellig-ltd.de!open-news-network.org!news.muarf.org!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!cleanfeed1-b.proxad.net!nnrp3-2.free.fr!not-for-mail From: Jean =?iso-8859-1?q?Fran=E7ois?= Martinez Subject: Re: Elaboration Question Newsgroups: comp.lang.ada References: <2f5e2392-68b0-4fe0-a224-57a060a6fd56@googlegroups.com> User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: 03 Jan 2015 18:43:17 GMT Message-ID: <54a83845$0$5118$426a74cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 03 Jan 2015 19:43:17 CET NNTP-Posting-Host: 82.225.39.24 X-Trace: 1420310597 news-1.free.fr 5118 82.225.39.24:45320 X-Complaints-To: abuse@proxad.net Xref: news.eternal-september.org comp.lang.ada:24330 Date: 2015-01-03T19:43:17+01:00 List-Id: On Sat, 03 Jan 2015 01:50:31 -0800, Hubert wrote: > > Thanks also to all the other posters, it's not an easy topic it seems. > Personally I prefer the initialization call to a library simply because > it gives the programmer the liberty of determining the place in the > sequence of initializations of a potential longer list of libraries > which may interfere with each other's initialization if the sequence is > not under program control. You can do this in Ada or you can just declare variables and constants and let elaboration take care of them. You cannot do the latter in C unless you like playing Russian roulette. Declaring data entities and letting elaboration ie the runtime take care allows you to do things like Start_Time: constant Time:=Clock; This a constant whose value is determined when Ada is initialized. So the constant changes from run to run but you will be safe of accidental modifications through Start_Time:= or through My_Access_Var.all:=. Unlike statically determined constants the operating system will not place it in read only memory so unlike them it _can_ be modified through use of machine addresses. But most of the time you don't need them so you are safe > I am forced to use a graphics library currently which calls your program > as a DLL and controls your program and boy is that a pain in the butt. > > If using Gnat then when main program is in another language it must call adainit. This will take care of elaboration. Since this graphics library is not under your control you must trick it. For instance if yur library calls mymain() then you must a mymain() in C consisting in a call to adainit. Read Gnat's documentation for details Jean-François Martinez