delorie.com is funded by banner ads.
  www.delorie.com/djgpp/v2faq/faq006.html   search  

| Previous | Next | Up | Top |

3.3 Will it work under Windows/NT?

Q: What about Windows NT?


A: Current Windows NT versions support DPMI programs in the DOS box, so DJGPP programs should in general run fine under NT (but see the list of possible problems below).

The DPMI server built into NT (and Windows 9X) loses selectors with each child program that is invoked by a DJGPP program, so after about two thousand calls to functions from the spawnXX family you can see an error message like this:

       Load error: no DPMI selectors

This problem is likely to afflict only DJGPP ports of Unix shells (such as bash), since no other DJGPP program, not even Make, is likely to call so many child programs before it exits. The only known work-around is to exit the shell every now and then, because when all the available selectors are exhausted, the DOS box will crash. I'm told that Make sometimes fails on long Makefiles on Windows 9X, where the selectors are lost at even higher rate than on NT. If you ever run a very long Makefile and see Make crash, just run Make again, and it will pick up where the crashed session has left off.

Note that the long filename API (the special functions of Int 21h which support file names longer than the DOS 8+3 limitation) for DOS box is not supported by current versions of Windows/NT, so you cannot have long filenames there from DJGPP programs. An alpha version of an LFN driver for NT which enables long file name support for DJGPP programs, written by Andrew Crabtree, can be downloaded from Andrew's site.

The popular DJGPP IDE RHIDE needs a -M switch to work on NT (to disable the mouse support which will otherwise crash RHIDE).

You might have problems with using the SVGA modes of your video card under Windows/NT. That is because NT doesn't allow direct access to the SVGA registers, without which it is impossible to recognize the type of the SVGA and employ its capabilities. For example, a user reported that GRX functions and the MODETEST.EXE program thought that only a standard VGA was installed, whereas he had an S3 card. There is nothing you can do about this feature of Windows/NT; that is the price you pay for the stability and protection you get under this OS (a runaway program that accesses hardware registers can wipe out your disk or wedge the entire system cold). However, I'm told that Windows/NT 4.0 supports DirectX which is a method of accessing screen, audio and other peripherals directly, so it might be possible to use full GRX graphics capabilities there.

Programs that use the "nearptr" facility of DJGPP to access absolute memory addresses (e.g., for memory-mapped devices) won't work on NT, because its DPMI server silently ignores functions that set huge limits on selectors. Since the default algorithm which allocates memory from the DPMI server needs to set such huge limit in some rare cases, there's a small probability that a program will fail or crash even if it doesn't set selector limits in user code. It is best to use the Unix-style sbrk algorithm in programs that run on Windows/NT. See the library docs for the variable _crt0_startup_flags where the _CRT0_FLAG_UNIX_SBRK bit is explained, for more info on this issue. If you cannot switch to the Unixy sbrk (e.g., if you don't have access to the program's sources), I'm told that sometimes such problems can be worked around if you run DJGPP programs in a full-screen session; your mileage may vary.

Some people report that NT servers cause much more problems than NT workstations of the same version and build. It seems that these problems usually mean that NT installation was done incorrectly (maybe it is much harder to get it right with a server than with a workstation?). If you have such problems, try to install a workstation, or re-install the server, and see if that helps. And if you gain some insight as to why servers like DJGPP less than workstations, please tell what you've learned.

The Cygnus Win32 project is another (unrelated to DJGPP) port of GCC and development tools to Windows/NT and Windows 9X platforms, which specifically targets development of Windows programs. See , for more details about the Cygnus ports.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright ⌐ 1998   by Eli Zaretskii     Updated Sep 1998  

Powered by Apache!

You can help support this site by visiting the advertisers that sponsor it! (only once each, though)