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

| Previous | Next | Up | Top |

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 to DJGPP which allows to develop Win32 programs. This is targeted for Win32 (Windows 9X and NT) and Win32s (Windows 3.X + Win32s) platforms (but the development environment will only run on Windows 9X/NT); it supports DJGPP v2.x and includes debugging tools and an IDE, but it needs to be registered (for a small fee) if you want 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 from SimTel.

RSXNTDJ was produced with GCC v2.7.2.1 and DJGPP v2.01. If you use it with later versions of GCC and DJGPP, you might need to tweak the installation a bit. People who succeeded in this feat report that they needed to make the following changes:

Some people report that they needed to bump up the stack size using the pestack utility, allegedly due to insufficient size of the default stack.

Note that the version of linker ld.exe which comes with RSXNTDJ doesn't print any message if you forget to link in libraries such as libcomct.a and libcomdl.a. Instead, the produced executables will die with SIGSEGV when run. Sometimes, forgetting to #include windows.h also produces a program that crashes at run time. You can use the stock DJGPP version of ld.exe to see the list of the missing functions, and then find out which libraries to add to the link command line (use the nm utility to find out which libraries contain the required external symbols).

If RSXNTDJ doesn't suit your needs, you can use a few other 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 file 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 ports of GCC and EGCS, the experimental version 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. Since it doesn't use any GPL'ed stuff except GCC and its subprograms, the programs produced by Mingw32 are free. For more details, visit the Mingw32 home page.
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 resource compiler and a resource browser, an IDE, and a Make utility. For more information, visit the Lcc home page and the lcc-win32 home page.
A better (but harder) way would be to volunteer to add Windows support to DJGPP.


  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)