Setup of OpenWatcom as Mini-DOSonly for FreeDOS/FreeCOM development

This little text is to summarize a discussion among Bart, Lucho, Arkady and Jim on the FreeDOS-kernel list about to switch to an OpenWatcom development environment useful for the FreeDOS kernel. Because I intend to switch to OpenWatcom as well in the nearer future for the FreeCOM development, I picked up the thread and pasted the posts together for the future.


To run OpenWatcom you need an Intel 386+ with at least 8MB of memory, because the compiler itself is a DOS32 program using a DOS extender if running under plain DOS, but it can compile for the real-mode target.

The files are located at:, which is a symlink to most current archive of .ZIP archives. The file _layout.txt describes the contents, however it seems to be missing except for the first release of the file.

The following archives will be required:

The following archives may be useful:

What about debugging?

To be written, yet.

Configuration / Setup

The readme.txt explains, that you have to setup environment variables as follows: A sample batch file to setup the OpenWatcom variables:
Note: Some Open Watcom tools currently do not function properly if installed in a directory with spaces in the name e.g. "C:\Program Files\WATCOM". Therefore choose a directory name like C:\WATCOM, D:\WATCOM etc. to install the tools in.


  • [Bart] by the way, wdis becomes a lot more useful if you compile with -d1 (line number info, no debug info that costs performance). Then you can also use -s to get the source code in the disassembly.
  • [Lucho] DOS4G=STARTUPBANNER:OFF (without "quiet"! ;-) This is for 4DOSGW of Watcom 11.0c; for 4DOSGW of OpenWatcom it may be "quiet STARUPBANNER:OFF" or just "quiet" ;-) It's interesting that when working with its "native" executable files, DOS4GW for Watcom 11.0c accepts "quiet STARTUPBANNER:OFF" but when working with OpenWatcom executable files it needs just "STARTUPBANNER:OFF".
  • [Bart] You can however use Causeway or DOS32A (maybe WDOSX too) by re-stubbing or simply renaming cwstub.exe or dos32a.exe to dos4gw.exe. Maybe that speeds it up a bit. Or maybe not. UPX-ing is also possible.
    dos4gw is easiest. The other you would have to rename (cwstub.exe -> dos4gw.exe). i'm not sure if pmode/w works as a drop-in replacement for the compiler itself.
    I have good experiences with causeway. your mileage may vary (esp. with QEMM I have no idea).

    The other extenders are located at the OpenWatcom FTP site, too:

  • [Bart] The tiny model uses the "small" libraries. The only thing that is different is the startup code. Compiling from C to .obj doesn't make any difference between small and tiny. Only linking.
    wcl -mt foo.obj (or wcl -mt foo.c, which calls wcc -ms)
    wcl -l=com foo.obj
    wlink sys com f foo.obj
  • [Bart] The IDE is not for bare DOS, only Windows (16 or 32) and OS/2. I have barely used it myself so I don't know much about it.
  • [Bart] This is for compiling on anyDOS (including FreeDOS) -- most of the DOS hosted executables are DPMI applications so will not work with FreeDOS emm386. If, however, you cross compile from Windows (95+/NT+) then you don't need to download the DOS hosted executables and it's much better to get the Win32 hosted compilers:
    cm_core_nt - Core binaries (NT host)
    core_nt - Core binaries (NT host)
    c_nt - C compiler (NT host)
    And similarly for OS/2.


Elvis - The VI clone