Next:Optimal hardware, Previous:i286, Up:Requirements
Q: Can I write MS-Windows applications with
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 22.214.171.124 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:
There's an alternative to using patched MSSDK headers: Anders Norlander's WinAPI headers. These headers can be used as a drop-in replacement for the RSXNTDJ headers, and they include the functionality of Microsoft's headers. Beginning with version 1.5.1, the RSXNTDJ package includes a modified version of Anders Norlander's headers as part of the distribution.
djdevNNN.zippackage). Therefore, your best bet would be to install RSXNTDJ in another directory, so that the headers and libraries don't mix. Make sure that when you compile DJGPP programs, the DJGPP include directories are searched before the RSXNTDJ ones, and when you compile RSXNTDJ programs, the RSXNTDJ include directories are searched first. Likewise, you should make sure the compiler looks in the correct directories for libraries and the
crt0.ostartup module. When in doubt, add
-vto the compiler's command line to see which directories it searches and in which order, and what libraries does it link in.
One specific problems with conflicting headers is with the header
Both DJGPP and RSXNTDJ have such a file, with different contents.
stdio.hheader supplied with RSXNTDJ defines several inline functions with the
externqualifier, which causes GCC to not compile them into the object file, and triggers undefined references. The solution is to define the
externsymbol to an empty string in one of the source files which includes the
cpp.exe) is kept to the
PATHenvironment variable, or copy the pre-processor into a directory already on your
PATHe.g. djgpp\bin. (Without this, the resource compiler will not work.)
pestackutility, allegedly due to insufficient size of the default stack.
ld.exewhich comes with RSXNTDJ doesn't print any message if you forget to link in libraries such as
libcomdl.a. Instead, the produced executables will die with SIGSEGV when run. Sometimes, forgetting to
windows.halso produces a program that crashes at run time. You can use the stock DJGPP version of
ld.exeto see the list of the missing functions, and then find out which libraries to add to the link command line (use the
nmutility to find out which libraries contain the required external symbols). The linker supplied with RSXNTDJ is only required to link DLLs.
If RSXNTDJ doesn't suit your needs, you can use a few other free compilers which target Win32 platforms:
Cygnus GNU-Win32 tools
Mingw32 (Minimal GNU-Win32)
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*.awrappers. 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.