www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/28/18:48:40

Date: Thu, 29 Feb 1996 07:36:23 -0800 (GMT)
From: Orlando Andico <oandico AT eee DOT upd DOT edu DOT ph>
To: Aaron Cronin <croninal AT boat DOT bt DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Virtek and GCC
In-Reply-To: <31346979.55C1@boat.bt.com>
Message-ID: <Pine.SOL.3.91.960229072803.505B-100000@gollum>
MIME-Version: 1.0

On Wed, 28 Feb 1996, Aaron Cronin wrote:

> Does anyone know if there is a way to compile programs which use
> VIRTEK's 3d-Ware V1.0 with DJGPP V2.0?
> 
> I tried to compile some old programs but GCC couldn't parse the 'far'
> keyword. I know GCC doesn't know 'far' but is there a way round this?
> -- 
> 

(I assume the "far" keyword is defined as a pointer modifier as in Turbo 
C++, and you have to use stuff like farmalloc () and farfree () to 
modify/manipulate it?)

If you have access to the source, at the top of the file you could put 
something like:

#ifdef DJGPP
#define far
#endif

so what happens is, the "far" keyword (which isn't ANSI so you can throw 
it out) gets defined to nothing. This doesn't hurt as it's just an MS-DOG 
construct to get around the 64K segment limit... but using DJGPP, a 
segment is 4GB in size (ahh... bliss -- prime reason for junking real mode).

Then, you could write stubs for farmalloc (), farfree () etc. pointing 
them to ordinary malloc (), free (), etc. Or write macros for them, like so:

#ifdef DJGPP
#define farmalloc(_Z_) malloc(_Z_)
#endif

and so on... I did something like this to a program I had written in 
Turbo C -- except, I had no intention of using TC again so I just did a 
global find-and-replace on the source code. The advantage of using 
#ifdef's etc is that the hacked code will still compile with your 16-bit 
compilers.

Of course, if the code uses "far" extensively, it probably has a load of 
MK_FP's and similar evils lurking in it... at least, you're in luck with 
inportb () etc since DJGPP has those too. But for the rest, you'll have 
to do some modifications. Not major ones, I suppose, unless you do things 
like call real-mode interrupts and set up handlers... something I'm not 
qualified to speculate about  :)

Good luck!

                                             ------------------------
                                              Orlando A. Andico
                                              oandico AT eee DOT upd DOT edu DOT ph
                                             ------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019