Sender: shinelight AT detroit DOT crosswinds DOT net Message-Id: <3.0.6.16.19990329203746.1d5f9470@pop.detroit.crosswinds.net> X-Sender: detr_shinelight AT pop DOT detroit DOT crosswinds DOT net X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.6 (16) Date: Mon, 29 Mar 1999 20:37:46 -0500 To: djgpp AT delorie DOT com From: "Thomas J. Hruska" Subject: Re: Another stupid question about "far" In-Reply-To: <3700043F.DE8E93CE@mindspring.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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