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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8f62275ace1d51c1,start X-Google-Attributes: gid103376,public From: Jonas Nygren Subject: [Q]: arrays into mmap'ed memory Date: 1996/08/28 Message-ID: <32249A94.4A0A@joy.ericsson.se>#1/1 X-Deja-AN: 177042918 content-type: text/plain; charset=us-ascii organization: Ericsson mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.0 (Win95; I) Date: 1996-08-28T00:00:00+00:00 List-Id: Can anybody help me with how to use mmap'ed memory in Ada. What I want to do is mmap a large file and then access parts of the so mapped memory via arrays. In C it is simple since arrays are more or less a language syntax on top of pointers, p[i] == *(p+i). How can I connect an Ada array to memory allocated via mmap? I do not want to store the bounds of the array in the mapped file - the file should just be plain ASCII. If I manage to get the array to point to the memory and the bounds to be set correctly what will happen when Ada tries to reclaim the array? Of course I could use a pointer and write my own access functions for this pointer but I think that it would be nicer to use arrays if possible. This probably sounds confused and reflects my understanding of Ada but perhaps you get the gist of my question and so can put me straight. TIA, /jonas PS mmap is a unix syscall which maps a file directly into memory without the need to allocate memory in your program - you sort of get access directly to the OS's file buffers which are loaded on access of the memory via direct page-in. DS