comp.lang.ada
 help / color / mirror / Atom feed
From: Mark Lorenzen <mark.lorenzen@gmail.com>
Subject: Re: Why can't objects be static in Ada?
Date: Tue, 23 Apr 2019 07:30:48 -0700 (PDT)
Date: 2019-04-23T07:30:48-07:00	[thread overview]
Message-ID: <95b32abb-8904-4229-8553-d85c68699023@googlegroups.com> (raw)
In-Reply-To: <ghmug9Fsp4kU1@mid.individual.net>

On Tuesday, April 16, 2019 at 11:07:24 PM UTC+2, Niklas Holsti wrote:
> On 19-04-16 23:56 , Lucretia wrote:
> > On Tuesday, 16 April 2019 13:11:36 UTC+1, Mark Lorenzen  wrote:
> >
> >> How can it be ensured that a library written in Ada does not
> >> require any elaboration. Pragma Pure? I think that such libraries
> >> are "nice" but pragma Pure is too restrictive for that purpose. In
> >> such cases it would be good, if e.g. the OP's problem could be
> >> solved at compile time without any elaboration.
> 
> Why are you so fixated on elaboration? Many non-Ada libraries require 
> initialization calls. Moreover, I believe a C++ program can have 
> compiler-generated initialization code similar to Ada elaboration code.
> 
> > I don't think it can, going by this thread. I also think this is why
> > Ada will fail in other environments, i.e. not security or safety
> > critical stuff, but where performance is important.
> 
> Performance is plenty important in many embedded real-time applications, 
> where Ada works just fine.
> 
> Elaboration of library items consumes execution time only at the start 
> of a program. Do you have some stringent start-up deadlines?
> 
> -- 
> Niklas Holsti
> Tidorum Ltd
> niklas holsti tidorum fi
>        .      @       .

Let's say I'm writing a static library in Ada that is to be used by a program written in C.

I can define a C-friendly API and export the API subprograms, but what happens if the library needs elaboration? Using GPRbuild I can define the library as a "standalone library" such that the binder generates the necessary initialization subprogram that performs elaboration. This is of course tool specific with the implications that this imposes.

Regards,
Mark L


  parent reply	other threads:[~2019-04-23 14:30 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11 12:40 Why can't objects be static in Ada? Lucretia
2019-04-11 12:56 ` Mark Lorenzen
2019-04-11 13:31   ` Lucretia
2019-04-11 22:49 ` Randy Brukardt
2019-04-12  1:56   ` Lucretia
2019-04-12  7:33     ` Dmitry A. Kazakov
2019-04-12 22:38     ` Randy Brukardt
2019-04-13  9:14       ` Lucretia
2019-04-12  6:59   ` Mark Lorenzen
2019-04-12  8:12     ` Simon Wright
2019-04-12 22:02     ` Randy Brukardt
2019-04-13 13:07 ` Jere
2019-04-13 13:48   ` Lucretia
2019-04-15 17:46     ` G. B.
2019-04-14  3:47 ` Keith Thompson
2019-04-16  0:08 ` sbelmont700
2019-04-16  1:40   ` Randy Brukardt
2019-04-16 12:11     ` Mark Lorenzen
2019-04-16 16:19       ` Simon Wright
2019-04-16 20:56       ` Lucretia
2019-04-16 21:07         ` Niklas Holsti
2019-04-16 21:16           ` Lucretia
2019-04-16 21:40             ` Niklas Holsti
2019-04-16 23:26             ` Randy Brukardt
2019-04-23 14:30           ` Mark Lorenzen [this message]
2019-04-16 23:09       ` Randy Brukardt
2019-04-22 20:05       ` Norman Worth
2019-04-16 20:54     ` Lucretia
2019-04-16 23:15       ` Randy Brukardt
2019-04-16 20:53   ` Lucretia
2019-04-18 13:32 ` sbelmont700
replies disabled

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