Difference between revisions of "Platform defines"

From Free Pascal wiki
Jump to navigationJump to search
 
(63 intermediate revisions by 12 users not shown)
Line 1: Line 1:
note: the tables in this article may not be complete
+
{{Platform_defines}}
==Useful tips before using platform defines==
 
  
* http://www.stack.nl/~marcov/buildfaq.pdf   - general building guidelines
+
== Useful tips before using platform defines ==
* http://www.stack.nl/~marcov/porting.pdf   - general porting guidelines
+
 
* if you need to cast a pointer to an integer for arithmetic or you wan't to provide a spare field (like tag in Tcomponent) that may be used to store a pointer use ptrint.
+
* [https://www.stack.nl/~marcov/buildfaq.pdf Marco van de Voort: Development Tutorial (a.k.a Build FAQ)] – general building guidelines
 +
* [https://www.stack.nl/~marcov/porting.pdf Marco van de Voort: Creating a portable Pascal codebase.] – general porting guidelines
 +
* if you need to cast a [[Pointer|pointer]] to an integer for arithmetic or you want to provide a spare field (like {{Doc|package=RTL|unit=classes|identifier=tcomponent.tag|text=<code>tag</code>}} in {{Doc|package=RTL|unit=classes|identifier=tcomponent|text=<code>TComponent</code>}}) that may be used to store a pointer, use {{Doc|package=RTL|unit=system|identifier=ptrint|text=<code>PtrInt</code>}} as signed type, or better {{Doc|package=RTL|unit=system|identifier=ptruint|text=<code>PtrUInt</code>}} as unsigned type.
  
 
==Architecture defines==
 
==Architecture defines==
 +
{{Note|This is a copy of the official [http://www.freepascal.org/docs-html/prog/progap7.html#x333-348000G FPC documentation] which is the authorative version for the stable FPC version.}}
  
 
{|
 
{|
 
!define(s)!!meaning
 
!define(s)!!meaning
 
|-
 
|-
!colspan=2!General
+
!colspan=2|General
 
|-
 
|-
 
|ENDIAN_BIG||big endian
 
|ENDIAN_BIG||big endian
Line 17: Line 19:
 
|ENDIAN_LITTLE||little endian
 
|ENDIAN_LITTLE||little endian
 
|-
 
|-
|CPU386,i386||386 and compatible (32 bit PC)
+
|CPU16||16 bit CPU
|}
+
|-
 
+
|CPU32||32 bit CPU
==Operating system defines==
+
|-
{|
+
|CPU64||64 bit CPU
!define(s)!!meaning
+
|-
 +
!colspan=2|Specific
 +
|-
 +
|CPU86||Intel 8086 and compatible (original PC)
 +
|-
 +
|CPU87||Intel 8086 and compatible (original PC)
 +
|-
 +
|CPU386, CPUi386||386 and compatible (32 bit PC)
 +
|-
 +
|CPUAMD64, CPUX86_64||AMD64 or Intel 64-bit processor
 +
|-
 +
|CPUIA64||Intel itanium 64-bit processor
 +
|-
 +
|CPU68||Motorola 680x0 or compatible CPU
 +
|-
 +
|CPU68K, CPUM68K||Motorola 680x0 or compatible CPU
 +
|-
 +
|CPUM68020||Motorola 68020 or compatible CPU
 +
|-
 +
|CPUPOWERPC||[[PPC Calling conventions|PowerPC processor]] (32 or 64 bit)
 +
|-
 +
|CPUPOWERPC32||PowerPC processor (32 bit)
 +
|-
 +
|CPUPOWERPC64||PowerPC processor (64 bit)
 +
|-
 +
|CPUSPARC, CPUSPARC32||SPARC v7 or compatible
 +
|-
 +
|CPUARM||ARM 32 bit processor
 +
|-
 +
|CPUAARCH64||ARM 64 bit processor
 +
|-
 +
|CPUAVR||AVR 8/16-bit processor
 +
|-
 +
!colspan=2|FPU
 +
|-
 +
|FPUSOFT||Software emulation of FPU (all types)
 +
|-
 +
|FPUSSE64||SSE64 FPU on Intel I386 and higher, AMD64.
 +
|-
 +
|FPUSSE||SSE instructions on Intel I386 and higher.
 +
|-
 +
|FPUSSE2||SSE 2 instructions on Intel I386 and higher.
 +
|-
 +
|FPUSSE3||SSE 3 instructions on Intel I386 and higher, AMD64.
 +
|-
 +
|FPULIBGCC||GCC library FPU emulation on ARM and M68K.
 +
|-
 +
|FPU68881||68881 on M68K.
 +
|-
 +
|FPUFPA||FPA on ARM.
 +
|-
 +
|FPUFPA10||FPA 10 on ARM.
 
|-
 
|-
!colspan=2!General
+
|FPUFPA11||FPA 11 on ARM.
 
|-
 
|-
|UNIX||any UNIX or UNIX-like system.
+
|FPUVFP||VFP on ARM.
 
|-
 
|-
|MSWINDOWS||all variants of windows
+
|FPUX87||X87 FPU on Intel I386 and higher.
 
|-
 
|-
!colspan=2!Specific
+
|FPUITANIUM||On Intel Itanium.
 
|-
 
|-
|LINUX||linux
+
|FPUSTANDARD||On PowerPC (32/64 bit).
 
|-
 
|-
|WIN32||32 bit windows
+
|FPUHARD||On Sparc.
 
|-
 
|-
|WIN64||64 bit windows
 
 
|}
 
|}
 +
 +
== Operating system defines ==
 +
 +
In the following tree, you have to follow leaves to their respective roots, in order to determine all defines. To check this information, refer to files in FPC sources: "compiler/systems/i_*.pas".
 +
 +
* <code>ATARI</code>
 +
* <code>DPMI</code>: MS-DOS
 +
** <code>GO32V2</code>
 +
** <code>WATCOM</code>
 +
* <code>EMACS</code>
 +
* <code>embedded</code>
 +
* <code>HASAMIGA</code>
 +
** <code>AMIGA</code>
 +
*** <code>AMIGA68K</code>
 +
*** <code>AMIGAOS4</code>
 +
** <code>AROS</code>
 +
** <code>MorphOS</code>
 +
* <code>GBA</code>: GameBoy Advance
 +
* <code>Java</code>
 +
* <code>MACOS</code>: Classic Macintosh (System 7 etc.)
 +
* <code>MSDOS</code> MS-DOS 16-bit real mode (defined since FPC version 2.7.1)
 +
* <code>NATIVENT</code>: [[Target NativeNT|NativeNT]]
 +
* <code>NDS</code>: Nintendo DS
 +
* <code>NETWARE</code>: NetWare
 +
** <code>NETWARE_CLIB</code>: NetWare with classic libc
 +
** <code>NETWLIBC</code>, <code>NETWARE_LIBC</code>: NetWare with modern libc
 +
* <code>OS2</code>: OS/2
 +
** <code>EMX</code>: emx
 +
* <code>PALMOS</code>: PalmOS and Garnet OS
 +
* <code>Symbian</code>: Symbian OS
 +
* <code>UNIX</code>
 +
** <code>AIX</code>
 +
** <code>ANDROID</code>
 +
** <code>BEOS</code>
 +
*** <code>HAIKU</code>
 +
** <code>BSD</code>
 +
*** <code>DARWIN</code>: [[Portal:Mac|macOS]] and [[Portal:iOS|iOS]]
 +
**** <code>iPhoneSim</code>
 +
*** <code>DragonFly</code>: DragonFlyBSD
 +
*** <code>FREEBSD</code>: FreeBSD
 +
*** <code>NETBSD</code>: NetBSD
 +
*** <code>OPENBSD</code>: OpenBSD
 +
** <code>LINUX</code>
 +
** <code>SUNOS</code>
 +
*** <code>SOLARIS</code>
 +
** <code>QNX</code>
 +
* <code>WDOSX</code>
 +
* <code>Wii</code>
 +
* <code>WINDOWS</code>: all [[Portal:Windows|Windows]]
 +
** <code>MSWINDOWS</code>
 +
*** <code>WIN16</code>: 16-bit Windows 3.x
 +
*** <code>WIN32</code>: 32-bit Windows
 +
*** <code>WIN64</code>: 64-bit Windows
 +
** <code>WINCE</code>, <code>UNDER_CE</code>, <code>UNICODE</code>: Windows CE, Windows mobile
 +
 +
== Notes ==
 +
<code>UNICODE</code> was defined till FPC 3.0.0, see [[User Changes 3.0#Define UNICODE was changed to FPC_OS_UNICODE|User changes 3.0 § “define UNICODE was changed to FPC_OS_UNICODE”]].
 +
 +
== See also ==
 +
* [https://delphi.wikia.com/wiki/FreePascal_detection_and_versioning Delphi Wikia article “FreePascal detection and versioning”]
 +
* [https://www.freepascal.org/docs-html/prog/progap7.html Free Pascal Documentation: Appendix G: Compiler defines during compilation]
 +
 +
{{Template:Directives, Defines and Conditionals}}
 +
[[Category:Directives]]

Latest revision as of 07:48, 1 April 2021

English (en) français (fr)

Useful tips before using platform defines

Architecture defines

Light bulb  Note: This is a copy of the official FPC documentation which is the authorative version for the stable FPC version.
define(s) meaning
General
ENDIAN_BIG big endian
ENDIAN_LITTLE little endian
CPU16 16 bit CPU
CPU32 32 bit CPU
CPU64 64 bit CPU
Specific
CPU86 Intel 8086 and compatible (original PC)
CPU87 Intel 8086 and compatible (original PC)
CPU386, CPUi386 386 and compatible (32 bit PC)
CPUAMD64, CPUX86_64 AMD64 or Intel 64-bit processor
CPUIA64 Intel itanium 64-bit processor
CPU68 Motorola 680x0 or compatible CPU
CPU68K, CPUM68K Motorola 680x0 or compatible CPU
CPUM68020 Motorola 68020 or compatible CPU
CPUPOWERPC PowerPC processor (32 or 64 bit)
CPUPOWERPC32 PowerPC processor (32 bit)
CPUPOWERPC64 PowerPC processor (64 bit)
CPUSPARC, CPUSPARC32 SPARC v7 or compatible
CPUARM ARM 32 bit processor
CPUAARCH64 ARM 64 bit processor
CPUAVR AVR 8/16-bit processor
FPU
FPUSOFT Software emulation of FPU (all types)
FPUSSE64 SSE64 FPU on Intel I386 and higher, AMD64.
FPUSSE SSE instructions on Intel I386 and higher.
FPUSSE2 SSE 2 instructions on Intel I386 and higher.
FPUSSE3 SSE 3 instructions on Intel I386 and higher, AMD64.
FPULIBGCC GCC library FPU emulation on ARM and M68K.
FPU68881 68881 on M68K.
FPUFPA FPA on ARM.
FPUFPA10 FPA 10 on ARM.
FPUFPA11 FPA 11 on ARM.
FPUVFP VFP on ARM.
FPUX87 X87 FPU on Intel I386 and higher.
FPUITANIUM On Intel Itanium.
FPUSTANDARD On PowerPC (32/64 bit).
FPUHARD On Sparc.

Operating system defines

In the following tree, you have to follow leaves to their respective roots, in order to determine all defines. To check this information, refer to files in FPC sources: "compiler/systems/i_*.pas".

  • ATARI
  • DPMI: MS-DOS
    • GO32V2
    • WATCOM
  • EMACS
  • embedded
  • HASAMIGA
    • AMIGA
      • AMIGA68K
      • AMIGAOS4
    • AROS
    • MorphOS
  • GBA: GameBoy Advance
  • Java
  • MACOS: Classic Macintosh (System 7 etc.)
  • MSDOS MS-DOS 16-bit real mode (defined since FPC version 2.7.1)
  • NATIVENT: NativeNT
  • NDS: Nintendo DS
  • NETWARE: NetWare
    • NETWARE_CLIB: NetWare with classic libc
    • NETWLIBC, NETWARE_LIBC: NetWare with modern libc
  • OS2: OS/2
    • EMX: emx
  • PALMOS: PalmOS and Garnet OS
  • Symbian: Symbian OS
  • UNIX
    • AIX
    • ANDROID
    • BEOS
      • HAIKU
    • BSD
      • DARWIN: macOS and iOS
        • iPhoneSim
      • DragonFly: DragonFlyBSD
      • FREEBSD: FreeBSD
      • NETBSD: NetBSD
      • OPENBSD: OpenBSD
    • LINUX
    • SUNOS
      • SOLARIS
    • QNX
  • WDOSX
  • Wii
  • WINDOWS: all Windows
    • MSWINDOWS
      • WIN16: 16-bit Windows 3.x
      • WIN32: 32-bit Windows
      • WIN64: 64-bit Windows
    • WINCE, UNDER_CE, UNICODE: Windows CE, Windows mobile

Notes

UNICODE was defined till FPC 3.0.0, see User changes 3.0 § “define UNICODE was changed to FPC_OS_UNICODE”.

See also

Directives, definitions and conditionals definitions
global compiler directives • local compiler directives

Conditional Compiler Options • Conditional compilation • Macros and Conditionals • Platform defines
$IF