"Review" of DOS compilers

5/30/02

Eric Auer writes:

Hi, the FreeDOS page now features a new pointer: follow the link to http://www.cix.co.uk/~mayday/Dev86dos-0.16.2.zip (200k) to get yet another 16bit compiler. The included assembler is more masm than at&t style, and can produce 16- or 32-bit code. The main C compiler just does plain C in a quite Unixish manner, I guess.

Also has a 6809 version. Output formats include EXE, 32bit EXE, COM and OMAGIC/QMAGIC (old-fashioned?) Linux.

You can even separate output into two chunks, Instruction and Data. I guess this compiler is nice for driver development (even for mixed real/protected mode things such as emm386, but it looks like being a bit too small for porting typical C / C++ projects. Plain K&R (ANSI or even less!?) C is there, not much more.

So for bigger projects, I still recommend the Borland compilers from the museum, which are still far smaller than for example the tens of MBys of OpenWatcom. If 32bit is ok for you (i.e. your program may use a DOS extender like cwsdpmi), then the DOS port of gcc/g++, djgpp, is probably your choice (depending on what you tell the "zip picker" on www.delorie.com, it is even considerably smaller than Watcom). My personal favourite is currently the plain Turbo C (2.3 MBy on the harddisk), as I do not use C++ a lot anyway...

PS: Take note that I did not actually test Bcc nor did the Watcom/DJGPP downloads. I have been reading the Bcc docs and browsed the DJGPP FAQ for quite a while. Over Watcom, I know that it has been a popular commercial compiler (see those apps which used DOS4/GW...!?) and that it can do 16bit, 32bit DPMI and 16/32bit Windows as output formats.

-Eric

PPS: DJGPP brings a rhIDE IDE and gdb and has a cross compiler backend for those who already have GCC for Linux (and are willing to recompile their GCC if needed...), while Watcom is currently one huge self-extractor which seems to include some Windows IDE. Borland uses a similar text mode IDE for all their "Turbo" compilers (C, C++, Pascal) which uses mostly WordStar (and joe) compatible editor keys... Bcc is just the plain Unix-style compiler.

Updates: (see Bart's comments on the mailing list)

First:

> A problem with Watcom: How do I keep the -download- small?

see ftp://ftp.openwatcom.org/watcom/zips there are some instructions in the kernel docs about which zips are necessary to compile the kernel if you like to do that with Watcom.

... Bart also points out that OpenWatcom has no dos extender included. Of course the problem only occurs when you compile to 32bit, and then you can use cwsdpmi or similar.

Second:

you point out that Watcom takes 10s of MB. This is not true if you only need to target 16bit DOS. A minimal C/C++ installation then takes 13MB, and less if you don't need C++. Although that is not as small as Turbo C.

For the kernel I recommend watcom for the simple reason that it generates tighter code (~6K) than the Borland museum tools. And now that it is opensource it gets even better.

Of course, if you target 32bits, DJGPP is the natural compiler for anything vaguely GNU related. Watcom is good too but DJGPP is now much more modern. But then of course, DJGPP also takes loads of MBs (I have 38 here, for just c and c++ command line).