comp.lang.ada
 help / color / mirror / Atom feed
From: "Michael Erdmann" <boavista@berlin.snafu.de>
Subject: Re: Q: How to do memory access with gnat
Date: 1997/07/20
Date: 1997-07-20T00:00:00+00:00	[thread overview]
Message-ID: <ckaobqsgzooryod.pminews@boavista.berlin.snafu.de> (raw)
In-Reply-To: qw67meleuoc.fsf@esmeralda.enst.fr


On 20 Jul 1997 15:10:11 +0200, Samuel Tardieu wrote:

:>>>>>> "Michael" == Michael Erdmann <boavista@berlin.snafu.de> writes:
:>
:>Michael> In Ada95 i am not able to copy data from an Ada object into a
:>Michael> some external memory.  Any idea ?
:>

:>You should try using the predefined generic package
:>System.Address_To_Access_Conversions. Then given a variable of type
:>System.Address, you can obtain an access value on your shared data.
The data structure to be stored in the shared stat looks like this,

type Message_Record( Record_Size : Integer ) is record
         Nbr_Of_Bytes     : Integer := Record_Size;
         data             :  Data_Buffer( 1,,Record_Size);
end record;

My Problem is to address the data array correctly. It seems because 
it is not managed under Ada memory management it is not possible
to do the following:

	To_Message(share),data(1,,Nbr_Of_Bytes) := data(1... )

I get allways a constraint error. In order to avoid this i thought about a 
procedure which is intended to set the shared memory  at a offset
relative to a certain base address. The result is this:

   procedure Store_At( base : Address ; offset : Integer ; value:BYTE ) is
      package BYTE_Access is new System.Address_To_Access_Conversions(
                                 Object => BYTE );
      use BYTE_Access;
   begin
      BYTE_Access.To_Pointer(base+offset).all := value;
   end Store_At;

But is does not work, because i am not able to add the offset to the base.

Michael








  reply	other threads:[~1997-07-20  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-07-20  0:00 Q: How to do memory access with gnat Michael Erdmann
1997-07-20  0:00 ` Tucker Taft
1997-07-20  0:00   ` Q: How to do memory access with gnat - os.ADB (0/1) Michael Erdmann
1997-07-20  0:00   ` Q: How to do memory access with gnat - OS.ADS (0/1) Michael Erdmann
1997-07-20  0:00   ` Q: How to do memory access with gnat - OS.ADS (1/1) Michael Erdmann
1997-07-20  0:00 ` Q: How to do memory access with gnat Samuel Tardieu
1997-07-20  0:00   ` Michael Erdmann [this message]
1997-07-22  0:00 ` Michael Erdmann
replies disabled

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