Node:Windows apps, Next:, Previous:i286, Up:Requirements

3.6 MS-Windows applications and DJGPP

Q: Can I write MS-Windows applications with DJGPP?

A: Currently, you can only run DJGPP programs under Windows as DOS apps (i.e. inside the DOS Box). If you need to write true Windows apps, you will have to use auxiliary tools or another compiler. This section lists some of the possibilities.

RSXNTDJ is an add-on package for DJGPP which allows to develop Win32 programs using DJGPP development environment. It is essentially a cross-compiler targeted for Win32 (Windows 9X and NT) and Win32s (Windows 3.X + Win32s) platforms6; it supports DJGPP v2.x and includes debugging tools and an IDE. Beginning with version 1.60, RSXNTDJ is distributed under the terms of the GNU license (previous versions needed to be registered for a small fee if you wanted to develop commercial or shareware applications with it).

RSXNTDJ supports Win32 console, GUI, DLLs and bound programs (the latter can be run on DOS under the RSX extender, as well as on Windows). You can download RSXNTDJ via FTP. The latest version of the RSX IDE (called RSXIDE) is available from Rainer Schnitker's home page. Rainer's home page is also the place to look for the latest releases of RSXNTDJ, including beta releases.

RSXNTDJ version 1.31 was produced with GCC v2.7.2.1 and DJGPP v2.01. If you use it with later versions of GCC and DJGPP, it will need some tweaking; it is best to upgrade to RSXNTDJ v1.5 or later. Johan Venter wrote a HOWTO document that explains how to install and set up RSXNTDJ, and how to fix the various problems present in the current RSXNTDJ distribution. Make sure you read the RSXNTDJ HOWTO, before you try to install the package on your own; it will save you hours of banging your head against all kinds of weird problems, like missing files (due to truncated file names), linker error messages, inability to link C++ programs, etc.

In general, RSXNTDJ's support leaves a lot to be desired. Some problems take too long to fix, and response to user bug reports is slow. Even with the latest efforts by Johan Venter and others, you should expect to spend some time and effort installing and using the package. Another problem is that you depend on Microsoft SDK for the header files, and each new release of the SDK tends to break the patches to the header files required by RSXNTDJ.

These are disadvantages of RSXNTDJ with respect to other alternatives (see below); the most significant advantage is that you can use the entire DJGPP development environment. By contrast, other alternatives for free Win32 development usually provide less tools; in particular, Mingw32 provides only a few basic tools (like Make and GDB) beyond the compiler and Binutils. As a result, people who work with Mingw32 tend to use all kinds of different and subtly incompatible versions of shells, Make, etc. Cygwin has much more ports of GNU tools, but even Cygwin tool-chain doesn't have such a rich set of development tools all working together smoothly as DJGPP does. (Of course, if you don't mind developing with a minimal set of tools, this might not be a serious consideration for you.)

Here are some tips about RSXNTDJ:

If RSXNTDJ doesn't suit your needs, you can use a few other free compilers which target Win32 platforms:

Cygnus GNU-Win32 tools
This tool-chain includes native Win32 ports of GCC and of many GNU development tools. It requires you to comply to the GNU License, the GPL, when distributing programs built with these tools. The tools and the programs you build are native Win32 executables (won't run on DOS, Windows 3.X or Win32s platforms) and Posix-compliant, but you need to distribute a 4MB DLL file7, which implements the Posix layer, with all your programs. Also, GNU-Win32 is still in beta phase, and some bugs are still worked on. You can find GNU-Win32 on the Cygnus site, or via FTP.
Mingw32 (Minimal GNU-Win32)
This features native Win32 port of GCC, but it relies on the Windows C runtime (CRTDLL.DLL, which is standard on Windows 9X and Windows/NT) and doesn't require any additional DLLs like Cygnus ports do; however, you lose the Posix layer. The basic package includes, besides the compiler and Binutils, a few tools to compile resource files and convert DLLs into lib*.a wrappers. Since it doesn't use any GPL'ed stuff except GCC and its subprograms, the programs produced by Mingw32 are free.

A disadvantage of this package is a relative lack of development tools ported to Mingw32. The compiler, Binutils, Make, GDB, Textutils and Patch are available from the Mingw32 site, but ports of other utilities tend to be scattered around and not integrated together into a coherent package like what DJGPP or Cygwin present. This causes compatibility problems between the tools. It is possible to use the DJGPP tools where there are no equivalent Mingw32 ones, but you need to be aware of some incompatibilities, such as different methods of passing long command lines, lack of support for long file names on NT, etc.

More details, including ready binaries of ported utilities and source-level patches to build other utilities with Mingw32, are available on Mingw32 home page. For ports of additional developemnt tools, visit Jan-Jaap van der Heijden's site. Mingw32 has a mailing list.

Lcc-Win32 compiler and tools
This is a Win32 port of a freeware compiler Lcc, not related to GCC. It doesn't currently support C++ programs. The tool-chain includes some additional utilities such as a very good IDE, a resource compiler and a resource browser, a Make utility, and an icon maker. The package documentation is very good. For more information, visit the Lcc home page and the lcc-win32 home page.
Dev-C++ package
This is a freeware compiler and development environment for C and C++ programs which produces Win32 executables. Besides the compiler, the package includes a set of header files and libraries, a port of GDB, an IDE with a multi-window editor that supports syntax highlighting, and a project management tool. The package is maintained by Colin Laplace, and is available from SimTel.NET mirrors.

If you need on-line documentation of the Win32 API, you can find it as a Windows HLP file. Additional links to tutorials and other related information can be found on the bowman's home page.

The recommended book for learning Win32 programming seems to be Charles Petzold's Programming Windows: The Definitive Guide to the Win32 API, published by Microsoft Press.