comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: pragma import => pointer in mapping table ?
Date: Tue, 05 Nov 2013 12:56:36 +0000
Date: 2013-11-05T12:56:36+00:00	[thread overview]
Message-ID: <lyfvrbroqj.fsf@pushface.org> (raw)
In-Reply-To: 2d53ec9f-1ae1-4547-ac08-6fef44ab490f@googlegroups.com

wkernow@gmail.com writes:

> In deed, I saw that all variables X derived from a "pragma import" are
> considered as pointers in mapping table whereas variables type of varX
> are not access types (basic types).

I expect the format of the map file depends on the version of the linker
ld used on your system.

But, what in the mapping table leads you to conclude that these
variables are treated as pointers?

If the C code contains a variable foo and the Ada code uses pragma
Import to access it, then the Ada-derived object module contains an
unsatisfied reference to the symbol foo (possibly _foo) and the
C-derived object module contains a definition of the symbol; the linker
uses the definition to satisfy the reference.

So what we have is a variable at an address which is known, and when the
Ada code reads the variable the corresponding machine code loads the
data at that address into a register (or whatever is appropriate).

You could think of this as an access via a pointer at the machine code
level, but at the Ada level this is just the same as any other variable
access.


  reply	other threads:[~2013-11-05 12:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05  9:49 pragma import => pointer in mapping table ? wkernow
2013-11-05 12:56 ` Simon Wright [this message]
2013-11-05 18:27   ` wkernow
2013-11-05 21:12     ` Simon Wright
2013-11-08 18:52 ` Per Sandberg
  -- strict thread matches above, loose matches on Subject: below --
2013-11-05  9:23 Pragma " wkernow
replies disabled

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