# DJGPP

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/DJGPP
> Markdown URL: https://mediated.wiki/source/DJGPP.md
> Source: https://en.wikipedia.org/wiki/DJGPP
> Source revision: 1298615701
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{short description|Implementation of the GNU toolchain for DOS}}

{{anchor|GO32}}
{{Infobox software
| name                   = DJGPP
| logo                   = djgpp logo.svg
| logo size              = 250px
| screenshot             = GCC DJGPP Windows.png
| caption                = The DJGPP environment, utilizing [GCC](/source/GNU_Compiler_Collection)
| developer              = DJ Delorie
| latest release version = 2.05
| latest release date    = {{start date and age|2015|11|03}}<ref>{{Cite newsgroup |url=https://groups.google.com/forum/#!topic/comp.os.msdos.djgpp/srgUBVOMGmI |title=Announce: DJGPP V2.05 Released |newsgroup=comp.os.msdos.djgpp |date=3 November 2015}}</ref>
| operating system       = [DOS](/source/DOS) and 32-bit [Windows](/source/Microsoft_Windows)
| genre                  = [Compiler](/source/Compiler)
| license                = [GNU GPL](/source/GNU_General_Public_License)
| website                = {{URL|www.delorie.com/djgpp}}
}}

'''DJ's GNU Programming Platform''' ('''DJGPP''')<ref>{{cite web|url=http://www.delorie.com/djgpp/doc/eli-m17n99.html#History|title=The DJGPP Project|date=Jul 1999|access-date=20 Jul 2009|author=Eli Zaretskii}}</ref> is a software development suite for [Intel 80386](/source/Intel_80386)-level and above, IBM [PC compatible](/source/PC_compatible)s which supports [DOS](/source/DOS) operating systems. It is guided by DJ Delorie, who began the project in 1989. It is a [port](/source/porting) of the [GNU Compiler Collection](/source/GNU_Compiler_Collection) (GCC), and mostly [GNU](/source/GNU) utilities such as [Bash](/source/Bash_(Unix_shell)), [find](/source/Find_(Unix)), [tar](/source/tar_(file_format)), [ls](/source/ls), G[AWK](/source/AWK), [sed](/source/sed), and [ld](/source/ld_(Unix)) to [DOS Protected Mode Interface](/source/DOS_Protected_Mode_Interface) (DPMI). Supported languages include [C](/source/C_(programming_language)), [C++](/source/C%2B%2B), [Objective-C](/source/Objective-C)/C++, [Ada](/source/Ada_(programming_language)), [Fortran](/source/Fortran), and [Pascal](/source/Pascal_(programming_language)).  It was originally called '''DJGCC''', and was later renamed from DJGCC to DJGPP when C++ support was added, though the "PP" was said to stand for "Programming Platform" rather than "Plus Plus".<ref name="delorie_com-history">{{cite web|title=The history of djgpp|url=http://www.delorie.com/djgpp/history.html}}</ref>

== Overview ==
The compiler generates 32-bit code, which runs natively in 32-bit [protected mode](/source/protected_mode) while switching back to 16-bit DOS calls for basic OS support. However, unlike the Open [Watcom C/C++ compiler](/source/Watcom_C%2FC%2B%2B_compiler), it is not a zero-based flat model due to preferring NULL pointer protection for better stability. It is currently based upon a variant of the [COFF](/source/COFF) format. It can access up to 4 GB of RAM in pure DOS when using a suitable [DPMI](/source/DOS_Protected_Mode_Interface) host (e.g., [CWSDPMI](/source/CWSDPMI) r7 or HDPMI32).

{{As of|2025|04}}, main components of DJGPP 2 include:
* [GNU Compiler Collection](/source/GNU_Compiler_Collection) 9.3.0 (10.2.0, 12.2.0 and 14.2.0<ref>{{Cite web |title=Mail Archives: djgpp-announce/2024/10/01/13:27:52 |url=https://www.delorie.com/archives/browse.cgi?p=djgpp-announce/2024/10/01/13:27:52 |access-date=2025-04-12 |website=www.delorie.com}}</ref> are also available, among other versions)
* [Autoconf](/source/Autoconf) 2.5.9
* [Automake](/source/Automake) 1.9.4
* [Binutils](/source/Binutils) 2.35.1
* [GNU Bash](/source/GNU_Bash) 4.4
* [GNU Bison](/source/GNU_Bison) 2.4.1, Flex 2.5.4
* [GNU Emacs](/source/GNU_Emacs) 29
* GNU MPC 1.1.0, MPFR 4.1.0

It is also possible to use DJGPP to cross-compile software to DOS, for example on UNIX / Linux. Both the DJGPP libraries and the programs can be compiled this way, linked and then deployed to machines with DOS or DOS emulators.

== Compatibility ==
DJGPP presents the programmer an interface which is compatible with the [ANSI C](/source/ANSI_C) and [C99](/source/C99) standards, DOS APIs, and an older [POSIX](/source/POSIX)-like environment. Compiled binaries are [long filename](/source/long_filename) (LFN) aware and can handle such names under most 32-bit Windows by default, but they cannot use the [Win16](/source/Win16) or Win32 APIs that graphical programs on Windows need.<ref name="wall">{{cite book |title=The Definitive Guide to GCC |first1=Kurt |last1=Wall |first2=William |last2=Von Hagen |publisher=Apress |year=2004 |url=https://books.google.com/books?id=VV1gB-9S9BIC&pg=PA47 |pages=47–48|isbn=9781590591093 |quote="Another popular, though aging, GCC-based development system is DJGPP, D.J.[sic] Delorie's free 32-bit development environment for DOS systems."}}</ref> [terminate-and-stay-resident](/source/terminate-and-stay-resident) (TSR) programs to support LFNs under plain [DOS](/source/DOS) or [Windows NT 4](/source/Windows_NT_4) are available.

While DJGPP runs in 32-bit [protected mode](/source/protected_mode), its stub and library heavily rely on many 16-bit DOS and BIOS calls. Because the [x86-64](/source/x86-64) versions of [Windows](/source/Microsoft_Windows) lack support for 16-bit programs,<ref>
{{cite web
| url = http://www.delorie.com/djgpp/doc/ug/intro/what-is-djgpp.html
| title = Guide: What is DJGPP?
| access-date = November 22, 2015
| archive-url = https://web.archive.org/web/20180801064336/https://www.delorie.com/djgpp/doc/ug/intro/what-is-djgpp.html
| archive-date = August 1, 2018
| url-status = dead
| quote = "The target hardware platform for DJGPP programs is a PC platform ... running DOS ... or a DOS-compatible operating system  DJGPP programs run under Windows' "dos prompt" boxes."}}
</ref><ref>
{{cite web
|url=http://support.microsoft.com/kb/282423
|title=List of limitations in 64-Bit Windows
|date=11 Oct 2007
|access-date=20 Apr 2010
|author=Microsoft
|quote="16-bit MS-DOS and Microsoft Windows 3.x utilities will not start. If you attempt to start such a program, you receive a "Program.exe is not a valid Win32 application" error message." |archive-url=https://web.archive.org/web/20100420181811/http://support.microsoft.com/kb/282423
 |archive-date=20 April 2010 |url-status=dead}}
</ref> there is no [NTVDM](/source/NTVDM), and DJGPP applications cannot be run. Under x86-64 systems these applications function only through emulation (e.g. [DOSBox](/source/DOSBox)), [x86 virtualization](/source/x86_virtualization) (e.g. [VirtualBox](/source/VirtualBox)), or similar (e.g. Linux's [DOSEMU](/source/DOSEMU)). This problem arises because in [long mode](/source/long_mode) x86-64 processors do not support the [virtual 8086 mode](/source/virtual_8086_mode) used to run 16-bit code in IA-32 processors. Newer x86 CPUs with [VT-x](/source/VT-x) do support paged real mode and unrestricted guest mode execution.

== See also ==
{{Portal|Free and open-source software}}

* [FreeDOS](/source/FreeDOS)
* [Cygwin](/source/Cygwin) - a UNIX compatibility layer with many ported libraries and applications
* [EMX](/source/EMX_(programming_environment)) - a POSIX implementation for DOS (and OS/2, too)
* [GnuWin32](/source/GnuWin32)
* [MinGW](/source/MinGW) - a port of the GNU toolchain for Windows, designed to require minimal runtime support
* Open [Watcom C/C++ compiler](/source/Watcom_C%2FC%2B%2B_compiler)
* [Allegro](/source/Allegro_(software_library))
* [Windows Subsystem for Linux](/source/Windows_Subsystem_for_Linux)

== References ==
{{Reflist}}

== External links ==
* {{official website|www.delorie.com/djgpp}}
* [http://www.delorie.com/users/dj/ DJ Delorie's webpage]

Category:1989 software
Category:C (programming language) compilers
Category:DOS extenders
Category:Free and open source compilers
Category:Free integrated development environments

---
Adapted from the Wikipedia article [DJGPP](https://en.wikipedia.org/wiki/DJGPP) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/DJGPP?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
