comp.lang.ada
 help / color / mirror / Atom feed
From: Samuel Tardieu <sam@ada.eu.org>
To: "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: <qw67meleuoc.fsf@esmeralda.enst.fr> (raw)
In-Reply-To: easwuowobrigfij.pminews@boavista.berlin.snafu.de


>>>>> "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.

Pseudo example:

with Dos_Utils;
with System.Address_To_Access_Conversions;

procedure Test is

   type My_Data is record
      [...]
   end record;

   package A_To_A is new System.Address_To_Access_Conversions (My_Data);
   subtype My_Data_Access is A_To_A.Object_Pointer;
   
   Addr : System.Address;
   Data : My_Data_Access;

begin
   Addr := Dos_Utils.Get_Shared_Memory (Data'Size / 8);
   Data := A_To_A.To_Pointer (Addr);
   [...you can use Data, it is pointing on an object stored in shared mem...]
end Test;

  Sam
-- 
Samuel Tardieu -- sam@ada.eu.org




  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 ` Samuel Tardieu [this message]
1997-07-20  0:00   ` Michael Erdmann
1997-07-20  0:00 ` Tucker Taft
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 - OS.ADS (0/1) Michael Erdmann
1997-07-20  0:00   ` Q: How to do memory access with gnat - os.ADB (0/1) Michael Erdmann
1997-07-22  0:00 ` Q: How to do memory access with gnat 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