Mail Archives: djgpp/2000/12/05/05:33:26
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.
- Raw text -