From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,18f3577df8d90927 X-Google-Attributes: gid103376,public From: "Michael Erdmann" Subject: Re: Q: How to do memory access with gnat Date: 1997/07/20 Message-ID: #1/1 X-Deja-AN: 257850253 References: Organization: Unlimited Surprise Systems, Berlin Reply-To: "Michael Erdmann" Newsgroups: comp.lang.ada Date: 1997-07-20T00:00:00+00:00 List-Id: On 20 Jul 1997 15:10:11 +0200, Samuel Tardieu wrote: :>>>>>> "Michael" == Michael Erdmann 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