Spikatrix
Spikatrix

Reputation: 20244

Why can't programs compiled using GCC be run using DOSbox while those compiled using Borland(Turbo C) can?

Years ago,I had created a program using TurboC IDE and This program can also be run using DOSbox. Now,when I tried to run any program which was compiled using GCC in DOSbox,this message came:

This program cannot be run in DOS mode

So my question is,Why isn't it possible to run programs compiled using GCC in DOSbox,while those compiled from TurboC are?

PS:The reason that I want to run them in DOSbox is that I want to run those programs in my phone(which has DOSbox installed).

Upvotes: 0

Views: 600

Answers (2)

Dan Chase
Dan Chase

Reputation: 1042

There is a GCC distribution called "DJGPP" which enables programs to be compiled using GCC, and uses DPMI to achieve this. Dos Protected Mode Interface, you have to run the program in protected mode, basically. There are other C environments such as Watcom that did the same thing, but I don't think Borland ever did anything with it.

Upvotes: 1

Ari0nhh
Ari0nhh

Reputation: 5920

Because MS DOS is 16-bit operating system and has no support for the 32-bit programs. Also modern operating systems has much stricter view on the direct hardware access, so modern programs must work through some hardware abstraction layers, which are also missing in the MS DOS.

Upvotes: 1

Related Questions