comp.lang.ada
 help / color / mirror / Atom feed
* using pragma export/adainit/adafinal with gnat...
@ 2002-08-02 12:21 Dale Stanbrough
  2002-08-02 18:55 ` Stephen Leake
  0 siblings, 1 reply; 5+ messages in thread
From: Dale Stanbrough @ 2002-08-02 12:21 UTC (permalink / raw)


I've read the gnat user's guide, and i have the
pragma export set up fine. I can manage to create
a program with a C main, and no elaboration required
(pure packages).

However when i try to call on adainit and adafinal
from the C program (after doing gnatbind -n), i keep 
getting link errors with the symbols

   _adainit
   _adafinal

not being found.

Any ideas on the exact series of commands required?

Dale



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: using pragma export/adainit/adafinal with gnat...
  2002-08-02 12:21 using pragma export/adainit/adafinal with gnat Dale Stanbrough
@ 2002-08-02 18:55 ` Stephen Leake
  2002-08-02 21:43   ` Dale Stanbrough
  2002-08-02 21:43   ` Dale Stanbrough
  0 siblings, 2 replies; 5+ messages in thread
From: Stephen Leake @ 2002-08-02 18:55 UTC (permalink / raw)


Dale Stanbrough <dstanbro@bigpond.net.au> writes:

> I've read the gnat user's guide, and i have the
> pragma export set up fine. I can manage to create
> a program with a C main, and no elaboration required
> (pure packages).
> 
> However when i try to call on adainit and adafinal
> from the C program (after doing gnatbind -n), i keep 
> getting link errors with the symbols
> 
>    _adainit
>    _adafinal
> 
> not being found.
> 
> Any ideas on the exact series of commands required?

If there is no elaboration required, it may be that the Ada compiler
does not generate 'adainit' and 'adafinal'. But it probably does.

If there is no elaboration required, and you have no cleanup either,
you don't need to call 'adainit' and 'adafinal'. But it's a good habit
to get into :).

What C compiler are you using? Different C compilers have different
link name conventions.

Are you using gnatbind as recommended, and compiling the code it
generates, and linking with it? That's where 'adainit' and 'adafinal'
are defined.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: using pragma export/adainit/adafinal with gnat...
  2002-08-02 18:55 ` Stephen Leake
@ 2002-08-02 21:43   ` Dale Stanbrough
  2002-08-04 14:24     ` Robert Dewar
  2002-08-02 21:43   ` Dale Stanbrough
  1 sibling, 1 reply; 5+ messages in thread
From: Dale Stanbrough @ 2002-08-02 21:43 UTC (permalink / raw)


Stephen Leake wrote:

> If there is no elaboration required, it may be that the Ada compiler
> does not generate 'adainit' and 'adafinal'. But it probably does.

I was just trying to figure out how to do it, having only read about
it previously.

> If there is no elaboration required, and you have no cleanup either,
> you don't need to call 'adainit' and 'adafinal'. But it's a good habit
> to get into :).

Indeed! (unless you -always- have pure packages).

> What C compiler are you using? Different C compilers have different
> link name conventions.
> 
> Are you using gnatbind as recommended, and compiling the code it
> generates, and linking with it? That's where 'adainit' and 'adafinal'
> are defined.

I was using gcc (cc1 actually) as the C compiler.
I've found another section in the gnat user manual which explained all
that had to be done, and it seems to be aok now.

Thanks anyway.

Dale



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: using pragma export/adainit/adafinal with gnat...
  2002-08-02 18:55 ` Stephen Leake
  2002-08-02 21:43   ` Dale Stanbrough
@ 2002-08-02 21:43   ` Dale Stanbrough
  1 sibling, 0 replies; 5+ messages in thread
From: Dale Stanbrough @ 2002-08-02 21:43 UTC (permalink / raw)


Stephen Leake wrote:

> If there is no elaboration required, it may be that the Ada compiler
> does not generate 'adainit' and 'adafinal'. But it probably does.

I was just trying to figure out how to do it, having only read about
it previously.

> If there is no elaboration required, and you have no cleanup either,
> you don't need to call 'adainit' and 'adafinal'. But it's a good habit
> to get into :).

Indeed! (unless you -always- have pure packages).

> What C compiler are you using? Different C compilers have different
> link name conventions.
> 
> Are you using gnatbind as recommended, and compiling the code it
> generates, and linking with it? That's where 'adainit' and 'adafinal'
> are defined.

I was using gcc (cc1 actually) as the C compiler.
I've found another section in the gnat user manual which explained all
that had to be done, and it seems to be aok now.

Thanks anyway.

Dale



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: using pragma export/adainit/adafinal with gnat...
  2002-08-02 21:43   ` Dale Stanbrough
@ 2002-08-04 14:24     ` Robert Dewar
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Dewar @ 2002-08-04 14:24 UTC (permalink / raw)


Dale Stanbrough <dstanbro@bigpond.net.au> wrote in message news:<dstanbro-1852AF.07432903082002@news-server.bigpond.net.au>...

> Indeed! (unless you -always- have pure packages).

There is nothing to guarantee that pure packages have
no elaboration code in the informal sense of the word.
There is some requirement in Annex C about not generating
memory write operations after load time, but load time is
implementation defined, so this is a dubious requirement.
There isn't even a definition of what a memory write
operation might be, that's just appealing to some informal
undefined concept. 

Whenever a requirement in the RM uses an undefined term,
the requirement is immediately dubious.

In GNAT, we have added

pragma Restrictions (No_Elaboration_Code);

to clearly pin down the issue of whether any code is
generated (in stuff we add for GNAT, we can be more informal than the RM :-)

Really the stuff about elaboration code should have been
implementation advice, then it could have been both clearer
and stronger.

An interesting thing about implementation advice is that
in practice, IA can often be stronger than a formal
requirement, since we are allowed to say what we mean
in informal, but perfectly clear terms.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-08-04 14:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-02 12:21 using pragma export/adainit/adafinal with gnat Dale Stanbrough
2002-08-02 18:55 ` Stephen Leake
2002-08-02 21:43   ` Dale Stanbrough
2002-08-04 14:24     ` Robert Dewar
2002-08-02 21:43   ` Dale Stanbrough

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