x86dos - Developing tools - DJGPP


How to use DJGPP/GCC in DosBox

I assume you have installed DJGPP (now V2.05) to c:\djgpp and CWSDPMI to c:\djgpp\bin. Here are steps to get DJGPP/GCC working in DosBox:

1. First download DosBoxlfn SVN build that supports long file name.

The offical DosBox has no long file name support which is required to run GCC compiler and related utilities. DosBoxlfn SVN build can be downloaded from:http://bit.ly/12jANWF or http://www.dosbox.com/wiki/SVN_Builds.

2. Set memsize to more than 40MB in DosBox configuration file or gpp will fail.

To change memsize for DosBox, open dosbox.conf in a text editor and find it in 'dosbox' section, then change its value to more than 40. Here is an example to set memsize to 48MB:


Start DosBox and run mem.exe to verify memory size:
You may also notice the long file names are displayed on the right side.

3.Start a compatible DPMI server in DosBox. Here I use CWSDOPMI and HXDOS as examples.

(1).Use CWSDPMI.

If no other DPMI servier loaded in memory, DJGPP automaticlly starts CWSDPMI in djgpp\bin folder if it exists. But before CWSDPMI can really work in DosBox for DJGPP, we must use CWSPARAM.EXE to disable SWAP file for it. Run CWSPARAM.EXE and leave "Full name of paging file" empty to disable it, also set 'Paragraphs of memory for extra CWSDPMI internal heap ? [256]' to 512.
And run go32-v2 to check if 40MB DPMI memory is available.

(2).Use HXDOS.

The latest version of HXDOS was V2.17 at the time I was writing. Its original download link is down, but you can still find it on Internet. Or you can download it from our site here:HXRT217_pwd_japheth.zip. The command line to run HXDOS:
hdpmi32 -x -r
After the above 3 steps, you are ready to use modern C++ in DosBox without issue. Here is an example of gcc compiling a CPP file contains C++14 features:

The result EXE can run in other DosBox builds too as long as no long file name usage in it.