Mail Archives: djgpp/1999/03/29/20:39:42
At 05:52 PM 3/29/99 -0500, you wrote:
>I know that DJGPP doesn't support the keyword "far" and I know the DJ
>Delorie posted some sort of zip file that would allow this but I can't
>find it now that I need it :-(
>
>I have a program that reads the header of a PCX file into a struct that
>has a serperate variable for every part of the header. The only way I
>know how to read this would be to do something like this:
>
>char far *temp = (char far *)image->header;
>
>for (index=0; index<128; index++)
> { temp[i] = getc(pcxfile); }
>
>But I can't do that without far pointers. Someone please tell me
>another way to read the header into a struct because I am stumped.
If you will remember, in 16-bit mode programming, you needed the far
keyword to get past the 65K limit set in the tiny, small, and medium memory
models to all that space in the rest of memory. Your compiler had its own
memory manager that made sure that you would have no problems with memory
that crossed the 65K segments, thus allowing you to allocate more than 65K
with functions like farmalloc().
However, you now want to use DJGPP. Since DJGPP is in 32-bit protected
mode, you no longer need the 'far' keyword. Why? Well, the answer lies in
the fact that all memory is linear and you can access any portion of memory
up to 4GB (depending on how DJGPP has set up its descriptor tables...help
here, anyone?). Thus, the 64K segment limits no longer exist. Just remove
everything that has a 'far' keyword in it and it will compile quite
happily. Sorry for the long explanation of why the far keywords are not
needed in DJGPP, hope that helped though!
Thomas J. Hruska -- shinelight AT detroit DOT crosswinds DOT net
Shining Light Productions -- "Meeting the needs of fellow programmers"
http://www.geocities.com/SiliconValley/Heights/8504
http://click-on.to/shinelight
- Raw text -