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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7f18265ce67560b3 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.35.68 with SMTP id f4mr184587pbj.5.1320754925956; Tue, 08 Nov 2011 04:22:05 -0800 (PST) Path: h5ni12469pba.0!nntp.google.com!news1.google.com!postnews.google.com!e2g2000vbb.googlegroups.com!not-for-mail From: awdorrin Newsgroups: comp.lang.ada Subject: Re: Memory Access Date: Tue, 8 Nov 2011 04:22:05 -0800 (PST) Organization: http://groups.google.com Message-ID: <35c7e403-6503-4e26-8764-9783caf84871@e2g2000vbb.googlegroups.com> References: <49f9578c-6f67-4af0-93b0-63120bfe23df@x28g2000prb.googlegroups.com> NNTP-Posting-Host: 192.91.173.42 Mime-Version: 1.0 X-Trace: posting.google.com 1320754925 23053 127.0.0.1 (8 Nov 2011 12:22:05 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 8 Nov 2011 12:22:05 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: e2g2000vbb.googlegroups.com; posting-host=192.91.173.42; posting-account=YkFdLgoAAADpWnfCBA6ZXMWTz2zHNd0j User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESRCNK X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1,gzip(gfe) Xref: news1.google.com comp.lang.ada:18856 Content-Type: text/plain; charset=ISO-8859-1 Date: 2011-11-08T04:22:05-08:00 List-Id: Thanks for the responses everyone - it will take me a little while to go through these and make sure I understand everything. To answer some questions and clarify things a bit: The original code was written in Ada83, which is probably why this code was implemented like this in the first place. We have Ada95 capable compilers available on both platforms. My primary goal is to get this code functional on Linux under GNAT but the secondary goal would be to determine a replacement method that would work on both platforms. I simplified the example I presented above. There is another Ada Package called 'DataManager' which holds common data structures. The Get_Object_Pointer and Get_UDP calls are from the DataManager package. During elaboration of the package that this code is in (RDevice) a configuration file is read which determines the number of devices that need to be held in the Dev_Table, this value is set in Num_Devs_Cnst. A call is made to the DataManager to allocate the memory needed from a larger memory segment which was previously obtained through a malloc of several MB. This memory segment is referred to as a 'Unique Data' area, so the UDP stands for 'Unique Data Pointer. All of these manipulations are trying to overlay the memory reserved in the DataManager into the RDevice's Dev_Table so that the RDevice package can read a data file and populate the records in Dev_Table. I had originally thought that I could use a declare section and the for 'Address notation to link the memory (as Adam suggested) - but the problem with this code is that the Dev_Table is defined as a global variable within the package and I don't know the memory address until run time. I'm not sure if, since Dev_Table is defined as a Dev_Table_Ptr_Type, which is access of Dev_Table_Type (which is the unconstrained array) if I could use a declare segment with a for'Address clause on another temporary variable of Dev_Table_Ptr_Type, and assign that to the Dev_Table. Something like: declare tempDevTable : Dev_Table_Ptr_Type := new Dev_Table_Type( 1 .. Num_Devs_Cnst ); for tempDevTable'Address use Dev_Data_Obj; begin Dev_Table := tempDevTable; end I'm thinking this would not work - too used to C pointers I suppose where it doesn't matter. ;) Thanks