comp.lang.ada
 help / color / mirror / Atom feed
From: "Jean François Martinez" <darkquark99@gmail.com>
Subject: Re: Elaboration Question
Date: 03 Jan 2015 18:43:17 GMT
Date: 2015-01-03T19:43:17+01:00	[thread overview]
Message-ID: <54a83845$0$5118$426a74cc@news.free.fr> (raw)
In-Reply-To: IXOpw.382949$Mq4.347198@fx25.iad

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

  reply	other threads:[~2015-01-03 18:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-02  3:27 Elaboration Question Hubert
2015-01-02  7:56 ` Simon Wright
2015-01-02 22:16   ` Randy Brukardt
2015-01-02 14:49 ` Brad Moore
2015-01-02 11:08   ` Mark Lorenzen
2015-01-02 13:35     ` David Botton
2015-01-02 15:11     ` sbelmont700
2015-01-02 21:57       ` Niklas Holsti
2015-01-06  2:33         ` Randy Brukardt
2015-01-06  8:17           ` Niklas Holsti
2015-01-06 20:06             ` Randy Brukardt
2015-01-03  9:45 ` Jean François Martinez
2015-01-03  9:50   ` Hubert
2015-01-03 18:43     ` Jean François Martinez [this message]
2015-01-04  1:57       ` Hubert
2015-01-04 12:05       ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox