www.delorie.com/djgpp/v2faq/faq3_6.html

  search  

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. RSXNTDJ is no longer maintained or supported by the author.

The latest version that can be used with DJGPP is RSXNTDJ version 1.5.1. Johan Venter made a patched version of RSXNTDJ 1.5 called 1.5.1 which will run without the problems usually encountered with version 1.5. Make sure you look at the included README file for instructions how to install RSXNTDJ. The package includes the Windows header files required to run the provided examples. RSXNTDJ will run with GCC 2.9.5.3 but not with any later version.

A problem is that you depend on the Microsoft SDK for the header files. If you want to use the latest version of the header files, which is often not necessary, you will have to patch these header files as 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. You can even compile programs that will run unchanged with DOS or Windows 7. 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.