Date: Tue, 5 Dec 2000 12:03:10 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Alex Oleynikov cc: DJGPP Mail List Subject: Re: Mapping a data structure into DOS memory space In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Mon, 4 Dec 2000, Alex Oleynikov wrote: > Now I have a problem - how can I neatly access that data from my program? As > far as I understand, there is no way to tell the linker to use the physical > address for relocation of the data structures, since it is below the 1MB > limit. I have investigated different possibilities of accessing that data > ( through _farX functions, or using "Fat DS" trick ), but they all > effectively limit my ability to use trivial "dot-style" variable access > within the structures. ??? The ``Fat DS'' (a.k.a. ``nearptr'') method should allow you to use the normal C operators for accessing the struct members. Why did you think it doesn't? > Now I have to play with the offsets of my elements > off the structure's starting address, which complicates the code and > decreases its readability. > Is there any other possible variant, which would allow me to still use > simple access to the data structures' elements? You could write a C++ class which overrides the . and -> operators with functions that use _far* to access the data. Alternatively, you could copy the struct's data between the conventional memory and your program's data segment (e.g., with dosmemget and dosmemput), and then access the copy with normal C code.