Reputation: 896
Is there any way I can compile my code for DOS? I have a simple C++ program that does not use any Windows API. I can run it under Windows using Visual Studio 2010, however, I need more speed without the Windows overhead. I wonder if there is any way I can compile it for running under DOS (or any real time platform) without any visual effects overhead? (It's clear I don't want to use very old compilers such as Turbo C++, because I loss the optimization benefits of MSVC compiler)
Regards
Upvotes: 2
Views: 4584
Reputation: 62096
DJGPP is a 32-bit gcc/g++ for DOS. It uses a DPMI host (CWSDPMI) to switch to the 32-bit protected mode. You can run the compiler either in DOS or in a VM with DOS (PC/VM+FreeDos or Dosbox). It will work in Windows 9x/2K/XP too (but generally not in Vista/7).
Open Watcom C/C++ is a 16/32-bit C/C++ compiler that can compile code for a variety of different platforms, including DOS. You can create 32-bit DPMI programs for DOS with it as well. The compiler can be run under DOS and Windows.
Similar to OW, Digital Mars is a 16/32-bit C/C++ compiler for DOS and Windows. AFAIK, the compiler can be run under Windows only.
You might also try using a compiler for Windows with WDOSX.
Upvotes: 4
Reputation: 97771
You probably don't want to compile for DOS. DOS is a 16-bit OS, and although you can probably get GCC for DOS and use that, I promise you that it's (DOS, not GCC) so obsolete that it's probably not what you want.
If compiling for the Windows command prompt is too slow, it's probably how you've written the program itself which is the problem. You are most likely trying to solve the wrong issue. If your issue is other services on your machine taking up resources, you may want to shut them down, uninstall them, or consider using Windows Server Core as your OS, which has a minimum of services and a very thin GUI, if you could call it that at all.
Upvotes: 5