Mail Archives: djgpp/1994/08/31/11:13:11
acmq AT alpha DOT coe DOT ufrj DOT br (Antonio Carlos Moreirao de Queiroz) writes:
> About portability,
> the changes having to be done in a program to run in DOS or UNIX are similar
> to what has to be done with other C compilers.
I had a ``pleasure'' of porting quite a few GNU programs to Borland
compiler in the past, and I can't disagree more with that statement.
While it's true that there are common changes that must be done for
any DOS-based compiler (there are things DOS just plainly cannot do),
DJGPP solves a large part of the porting problem. Below are some
problems which disappeared for me once I switched to DJGPP:
1. Memory limitations. This is a major headache when porting
GNU software to a PC, because GNU traditionally and conciously assume
your machine have limitless memory. Going through the code trying to
figure out what structures might need a huge pointer, then searching all
pointers which reference those structures--is a nightmare. And after
all that, some real memory hogs would blow into your face on a large
input, because they hit 640K.
2. The same applies to int's, some of which must be long's
under 16-bit compiler. Once again you should find them, introduce
some #ifdef __MSDOS__ for them, then find other variables which
depend on them and should also be converted to long... I found
that most of the time I end up knowing how the ported program works
no less than its author.
3. Header files. There are too many of these which just aren't
there in 16-bit DOS compilers (which all mimic Microsoft more or less).
So either you invent them or you're in for more #ifdef'ing. Other
headers exist, but have different contents. There are functions
(like bzero(), bcopy(), etc.) which don't exist at all. Sure enough,
more #ifdef's and #define's.
Compare all of the above to just typing ``make'' and then sitting
back watching the compiles run without a single warning, which
happens to me every time I use DJGPP. Gosh, I almost forget it
ain't a Sun in front of me! The only thing I have to do manually
nowadays is to update my config.h with whatever #define's the new
program expects from GNU environment. For the things DOS can't do
I wrote long ago a script which automagically displays all the
suspicious places, and I fix them in a matter of hours.
So in my view, DJGPP also makes *a big difference* portability-wise.
Thanks again, DJ and everybody else who worked and continues to work
on it!
Eli Zaretskii
- Raw text -