2
0

IdCompilerDefines.inc 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098
  1. {$IFDEF CONDITIONALEXPRESSIONS}
  2. // Must be at the top...
  3. {$IF CompilerVersion >= 24.0}
  4. {$LEGACYIFEND ON}
  5. {$IFEND}
  6. {$ENDIF}
  7. // General
  8. // Make this $DEFINE to use the 16 color icons required by Borland
  9. // or DEFINE to use the 256 color Indy versions
  10. {.$DEFINE Borland}
  11. // S.G. 4/9/2002: IPv4/IPv6 general switch (for defaults only)
  12. {$DEFINE IdIPv4} // use IPv4 by default
  13. {.$IFDEF IdIPv6} // use IPv6 by default
  14. {$DEFINE INDY100}
  15. {$DEFINE 10_6_3} //so developers can IFDEF for this product version
  16. {$DEFINE 10_6_3_9} //so developers can IFDEF for this specific version
  17. // When generating C++Builder output files, certain workarounds to compiler
  18. // problems need to be enabled! When invoking DCC on the command-line, use
  19. // the -DBCB parameter. When invoking MSBUILD, include the DCC_Define="BCB"
  20. // attribute in the /p parameter.
  21. {$IFDEF BCB}
  22. {$DEFINE CBUILDER}
  23. {$ELSE}
  24. {$DEFINE DELPHI}
  25. {$ENDIF}
  26. {$UNDEF USE_OPENSSL}
  27. {$UNDEF STATICLOAD_OPENSSL}
  28. {$UNDEF USE_ZLIB_UNIT}
  29. {$UNDEF USE_SSPI}
  30. // $DEFINE the following if the global objects in the IdStack and IdThread
  31. // units should be freed on finalization
  32. {.$DEFINE FREE_ON_FINAL}
  33. {$UNDEF FREE_ON_FINAL}
  34. // Make sure the following is $DEFINE'd only for suitable environments
  35. // as specified further below. This works in conjunction with the
  36. // FREE_ON_FINAL define above.
  37. {$UNDEF REGISTER_EXPECTED_MEMORY_LEAK}
  38. {$UNDEF HAS_System_RegisterExpectedMemoryLeak}
  39. // FastMM is natively available in BDS 2006 and higher. $DEFINE the
  40. // following if FastMM has been installed manually in earlier versions
  41. {.$DEFINE USE_FASTMM4}
  42. {$UNDEF USE_FASTMM4}
  43. // $DEFINE the following if MadExcept has been installed manually in
  44. // BDS 2005 or earlier (System.RegisterExpectedMemoryLeak() was introduced
  45. // in BDS 2006)
  46. {.$DEFINE USE_MADEXCEPT}
  47. {$UNDEF USE_MADEXCEPT}
  48. // $DEFINE the following if LeakCheck has been installed manually in
  49. // BDS 2005 or earlier (System.RegisterExpectedMemoryLeak() was introduced
  50. // in BDS 2006)
  51. {.$DEFINE USE_LEAKCHECK}
  52. {$UNDEF USE_LEAKCHECK}
  53. // Make sure the following are $DEFINE'd only for Delphi/C++Builder 2009 onwards
  54. // as specified further below. The VCL is fully Unicode, where the 'String'
  55. // type maps to System.UnicodeString, not System.AnsiString anymore
  56. {$UNDEF STRING_IS_UNICODE}
  57. {$UNDEF STRING_IS_ANSI}
  58. {$UNDEF STRING_UNICODE_MISMATCH}
  59. // Make sure the following are $DEFINE'd only for suitable environments
  60. // as specified further below. Delphi/C++Builder Mobile/NextGen compilers
  61. // do not support Ansi data types anymore, and is moving away from raw
  62. // pointers as well.
  63. //
  64. // UPDATE: in Delphi/C++Builder 10.4, all Ansi types are supported again on
  65. // all platforms, including the mobile compilers.
  66. {$DEFINE HAS_AnsiString}
  67. {$DEFINE HAS_AnsiChar}
  68. {$DEFINE HAS_PAnsiChar}
  69. {$UNDEF HAS_PPAnsiChar}
  70. {$UNDEF NO_ANSI_TYPES}
  71. // Make sure the following are $DEFINE'd only for suitable environments
  72. // as specified further below. Delphi/C++Builder Mobile/NextGen compilers
  73. // use ARC for TObject life time management.
  74. //
  75. // UPDATE: ARC for TObject lifetime management has been removed in
  76. // Delphi/C++Builder 10.4 mobile compilers. All platforms now use a single
  77. // unified memory management model!
  78. {$UNDEF USE_MARSHALLED_PTRS}
  79. {$UNDEF HAS_MarshaledAString}
  80. {$UNDEF USE_OBJECT_ARC}
  81. // Make sure the following is $DEFINE'd only for suitable environments
  82. // as specified further below.
  83. {$UNDEF STRING_IS_IMMUTABLE}
  84. {$UNDEF HAS_DIRECTIVE_ZEROBASEDSTRINGS}
  85. // Make sure the following are $DEFINE'd only for suitable environments
  86. // as specified further below.
  87. {$UNDEF HAS_TEncoding}
  88. {$UNDEF HAS_TEncoding_GetEncoding_ByEncodingName}
  89. {$UNDEF HAS_Exception_RaiseOuterException}
  90. {$UNDEF HAS_System_ReturnAddress}
  91. {$UNDEF HAS_TCharacter}
  92. {$UNDEF HAS_TInterlocked}
  93. {$UNDEF HAS_TNetEncoding}
  94. // Make sure that this is defined only for environments where we are using
  95. // the iconv library to charactor conversions.
  96. {.$UNDEF USE_ICONV}
  97. {.$UNDEF USE_LCONVENC}
  98. //Define for Delphi cross-compiler targetting Posix
  99. {$UNDEF USE_VCL_POSIX}
  100. {$UNDEF HAS_ComponentPlatformsAttribute}
  101. {$UNDEF HAS_ComponentPlatformsAttribute_Win32}
  102. {$UNDEF HAS_ComponentPlatformsAttribute_Win64}
  103. {$UNDEF HAS_ComponentPlatformsAttribute_OSX32}
  104. {$UNDEF HAS_ComponentPlatformsAttribute_iOS_Simulator}
  105. {$UNDEF HAS_ComponentPlatformsAttribute_iOS_Simulator32}
  106. {$UNDEF HAS_ComponentPlatformsAttribute_Android}
  107. {$UNDEF HAS_ComponentPlatformsAttribute_Android32Arm}
  108. {$UNDEF HAS_ComponentPlatformsAttribute_Linux32}
  109. {$UNDEF HAS_ComponentPlatformsAttribute_iOS_Device}
  110. {$UNDEF HAS_ComponentPlatformsAttribute_iOS_Device32}
  111. {$UNDEF HAS_ComponentPlatformsAttribute_Linux64}
  112. {$UNDEF HAS_ComponentPlatformsAttribute_WinNX32}
  113. {$UNDEF HAS_ComponentPlatformsAttribute_WinIoT32}
  114. {$UNDEF HAS_ComponentPlatformsAttribute_iOS_Device64}
  115. {$UNDEF HAS_ComponentPlatformsAttribute_WinARM}
  116. {$UNDEF HAS_ComponentPlatformsAttribute_WinARM32}
  117. {$UNDEF HAS_ComponentPlatformsAttribute_OSX64}
  118. {$UNDEF HAS_ComponentPlatformsAttribute_OSXNX64}
  119. {$UNDEF HAS_ComponentPlatformsAttribute_Linux32Arm}
  120. {$UNDEF HAS_ComponentPlatformsAttribute_Linux64Arm}
  121. {$UNDEF HAS_ComponentPlatformsAttribute_Android64}
  122. {$UNDEF HAS_ComponentPlatformsAttribute_Android64Arm}
  123. {$UNDEF HAS_ComponentPlatformsAttribute_iOS_Simulator64}
  124. {$UNDEF HAS_ComponentPlatformsAttribute_AndroidArm32}
  125. {$UNDEF HAS_ComponentPlatformsAttribute_AndroidArm64}
  126. {$UNDEF HAS_ComponentPlatformsAttribute_OSXArm64}
  127. {$UNDEF HAS_ComponentPlatformsAttribute_AllPlatforms}
  128. {$UNDEF HAS_DIRECTIVE_WARN_DEFAULT}
  129. // Define for Delphi to auto-generate platform-appropriate '#pragma link' statements in HPP files
  130. {$UNDEF HAS_DIRECTIVE_HPPEMIT_LINKUNIT}
  131. // detect compiler versions
  132. {$IFNDEF FPC}
  133. // TODO: to detect features in Delphi/C++Builder v6 and later, use CompilerVersion
  134. // and RTLVersion constants instead of VERXXX defines. We still support v5, which
  135. // does not have such constants.
  136. // Delphi 4
  137. {$IFDEF VER120}
  138. {$DEFINE DCC}
  139. {$DEFINE VCL_40}
  140. {$DEFINE DELPHI_4}
  141. {$ENDIF}
  142. // C++Builder 4
  143. {$IFDEF VER125}
  144. {$DEFINE DCC}
  145. {$DEFINE VCL_40}
  146. {$DEFINE CBUILDER_4}
  147. {$ENDIF}
  148. // Delphi & C++Builder 5
  149. {$IFDEF VER130}
  150. {$DEFINE DCC}
  151. {$DEFINE VCL_50}
  152. {$IFDEF CBUILDER}
  153. {$DEFINE CBUILDER_5}
  154. {$ELSE}
  155. {$DEFINE DELPHI_5}
  156. {$ENDIF}
  157. {$ENDIF}
  158. //Delphi & C++Builder 6
  159. {$IFDEF VER140}
  160. {$DEFINE DCC}
  161. {$DEFINE VCL_60}
  162. {$IFDEF CBUILDER}
  163. {$DEFINE CBUILDER_6}
  164. {$ELSE}
  165. {$DEFINE DELPHI_6}
  166. {$ENDIF}
  167. {$ENDIF}
  168. //Delphi 7
  169. {$IFDEF VER150}
  170. {$DEFINE DCC}
  171. {$DEFINE VCL_70}
  172. {$DEFINE DELPHI_7} // there was no C++ Builder 7
  173. {$ENDIF}
  174. //Delphi 8
  175. {$IFDEF VER160}
  176. {$DEFINE DCC}
  177. {$DEFINE VCL_80}
  178. {$DEFINE DELPHI_8} // there was no C++ Builder 8
  179. {$ENDIF}
  180. //Delphi 2005
  181. {$IFDEF VER170}
  182. {$DEFINE DCC}
  183. {$DEFINE VCL_2005}
  184. {$DEFINE DELPHI_2005} // there was no C++Builder 2005
  185. {$ENDIF}
  186. // NOTE: CodeGear decided to make Highlander be a non-breaking release
  187. // (no interface changes, thus fully backwards compatible without any
  188. // end user code changes), so VER180 applies to both BDS 2006 and
  189. // Highlander prior to the release of RAD Studio 2007. Use VER185 to
  190. // identify Highlanger specifically.
  191. //Delphi & C++Builder 2006
  192. //Delphi & C++Builder 2007 (Highlander)
  193. {$IFDEF VER180}
  194. {$DEFINE DCC}
  195. {$DEFINE VCL_2006}
  196. {$IFDEF CBUILDER}
  197. {$DEFINE CBUILDER_2006}
  198. {$ELSE}
  199. {$DEFINE DELPHI_2006}
  200. {$ENDIF}
  201. {$ENDIF}
  202. //Delphi & C++Builder 2007 (Highlander)
  203. {$IFDEF VER185}
  204. {$DEFINE DCC}
  205. {$UNDEF VCL_2006}
  206. {$DEFINE VCL_2007}
  207. {$IFDEF CBUILDER}
  208. {$UNDEF CBUILDER_2006}
  209. {$DEFINE CBUILDER_2007}
  210. {$ELSE}
  211. {$UNDEF DELPHI_2006}
  212. {$DEFINE DELPHI_2007}
  213. {$ENDIF}
  214. {$ENDIF}
  215. // BDS 2007 NET personality uses VER190 instead of 185.
  216. //Delphi .NET 2007
  217. {$IFDEF VER190}
  218. {$DEFINE DCC}
  219. {$IFDEF CIL}
  220. //Delphi 2007
  221. {$DEFINE VCL_2007}
  222. {$DEFINE DELPHI_2007}
  223. {$ENDIF}
  224. {$ENDIF}
  225. //Delphi & C++Builder 2009 (Tiburon)
  226. {$IFDEF VER200}
  227. {$DEFINE DCC}
  228. {$DEFINE VCL_2009}
  229. {$IFDEF CBUILDER}
  230. {$DEFINE CBUILDER_2009}
  231. {$ELSE}
  232. {$DEFINE DELPHI_2009}
  233. {$ENDIF}
  234. {$ENDIF}
  235. //Delphi & C++Builder 2010 (Weaver)
  236. {$IFDEF VER210}
  237. {$DEFINE DCC}
  238. {$DEFINE VCL_2010}
  239. {$IFDEF CBUILDER}
  240. {$DEFINE CBUILDER_2010}
  241. {$ELSE}
  242. {$DEFINE DELPHI_2010}
  243. {$ENDIF}
  244. {$ENDIF}
  245. //Delphi & C++Builder XE (Fulcrum)
  246. {$IFDEF VER220}
  247. //REMOVE DCC DEFINE after the next Fulcrum beta.
  248. //It will be defined there.
  249. {$IFNDEF DCC}
  250. {$DEFINE DCC}
  251. {$ENDIF}
  252. {$DEFINE VCL_XE}
  253. {$IFDEF CBUILDER}
  254. {$DEFINE CBUILDER_XE}
  255. {$ELSE}
  256. {$DEFINE DELPHI_XE}
  257. {$ENDIF}
  258. {$ENDIF}
  259. // DCC is now defined by the Delphi compiler starting in XE2
  260. //Delphi & CBuilder XE2 (Pulsar)
  261. {$IFDEF VER230}
  262. {$DEFINE VCL_XE2}
  263. {$IFDEF CBUILDER}
  264. {$DEFINE CBUILDER_XE2}
  265. {$ELSE}
  266. {$DEFINE DELPHI_XE2}
  267. {$ENDIF}
  268. {$ENDIF}
  269. //Delphi & CBuilder XE3 (Waterdragon)
  270. //Delphi & CBuilder XE3.5 (Quintessence - early betas only)
  271. {$IFDEF VER240}
  272. {$DEFINE VCL_XE3}
  273. {$IFDEF CBUILDER}
  274. {$DEFINE CBUILDER_XE3}
  275. {$ELSE}
  276. {$DEFINE DELPHI_XE3}
  277. {$ENDIF}
  278. {$ENDIF}
  279. //Delphi & CBuilder XE4 (Quintessence)
  280. {$IFDEF VER250}
  281. {$UNDEF VCL_XE3}
  282. {$DEFINE VCL_XE4}
  283. {$IFDEF CBUILDER}
  284. {$UNDEF CBUILDER_XE3}
  285. {$DEFINE CBUILDER_XE4}
  286. {$ELSE}
  287. {$UNDEF DELPHI_XE3}
  288. {$DEFINE DELPHI_XE4}
  289. {$ENDIF}
  290. {$ENDIF}
  291. //Delphi & CBuilder XE5 (Zephyr)
  292. {$IFDEF VER260}
  293. {$DEFINE VCL_XE5}
  294. {$IFDEF CBUILDER}
  295. {$DEFINE CBUILDER_XE5}
  296. {$ELSE}
  297. {$DEFINE DELPHI_XE5}
  298. {$ENDIF}
  299. {$ENDIF}
  300. //Delphi & CBuilder AppMethod
  301. //AppMethod is just XE5 for mobile only, VCL is removed
  302. {$IFDEF VER265}
  303. {$DEFINE VCL_XE5}
  304. {$IFDEF CBUILDER}
  305. {$DEFINE CBUILDER_XE5}
  306. {$ELSE}
  307. {$DEFINE DELPHI_XE5}
  308. {$ENDIF}
  309. {$ENDIF}
  310. //Delphi & CBuilder XE6 (Proteus)
  311. {$IFDEF VER270}
  312. {$DEFINE VCL_XE6}
  313. {$IFDEF CBUILDER}
  314. {$DEFINE CBUILDER_XE6}
  315. {$ELSE}
  316. {$DEFINE DELPHI_XE6}
  317. {$ENDIF}
  318. {$ENDIF}
  319. //Delphi & CBuilder XE7 (Carpathia)
  320. {$IFDEF VER280}
  321. {$DEFINE VCL_XE7}
  322. {$IFDEF CBUILDER}
  323. {$DEFINE CBUILDER_XE7}
  324. {$ELSE}
  325. {$DEFINE DELPHI_XE7}
  326. {$ENDIF}
  327. {$ENDIF}
  328. //Delphi & CBuilder XE8 (Elbrus)
  329. {$IFDEF VER290}
  330. {$DEFINE VCL_XE8}
  331. {$IFDEF CBUILDER}
  332. {$DEFINE CBUILDER_XE8}
  333. {$ELSE}
  334. {$DEFINE DELPHI_XE8}
  335. {$ENDIF}
  336. {$ENDIF}
  337. //Delphi & CBuilder 10.0 Seattle (Aitana)
  338. {$IFDEF VER300}
  339. {$DEFINE VCL_10_0}
  340. {$IFDEF CBUILDER}
  341. {$DEFINE CBUILDER_VCL_10_0}
  342. {$ELSE}
  343. {$DEFINE DELPHI_VCL_10_0}
  344. {$ENDIF}
  345. {$ENDIF}
  346. //Delphi & CBuilder 10.1 Berlin (BigBen)
  347. {$IFDEF VER310}
  348. {$DEFINE VCL_10_1}
  349. {$IFDEF CBUILDER}
  350. {$DEFINE CBUILDER_10_1}
  351. {$ELSE}
  352. {$DEFINE DELPHI_10_1}
  353. {$ENDIF}
  354. {$ENDIF}
  355. //Delphi & CBuilder 10.2 Tokyo (Godzilla)
  356. {$IFDEF VER320}
  357. {$DEFINE VCL_10_2}
  358. {$IFDEF CBUILDER}
  359. {$DEFINE CBUILDER_10_2}
  360. {$ELSE}
  361. {$DEFINE DELPHI_10_2}
  362. {$ENDIF}
  363. {$ENDIF}
  364. //Delphi & CBuilder 10.3 Rio (Carnival)
  365. {$IFDEF VER330}
  366. {$DEFINE VCL_10_3}
  367. {$IFDEF CBUILDER}
  368. {$DEFINE CBUILDER_10_3}
  369. {$ELSE}
  370. {$DEFINE DELPHI_10_3}
  371. {$ENDIF}
  372. {$ENDIF}
  373. //Delphi & CBuilder 10.4 Sydney (Denali)
  374. {$IFDEF VER340}
  375. {$DEFINE VCL_10_4}
  376. {$IFDEF CBUILDER}
  377. {$DEFINE CBUILDER_10_4}
  378. {$ELSE}
  379. {$DEFINE DELPHI_10_4}
  380. {$ENDIF}
  381. {$ENDIF}
  382. //Delphi & CBuilder 11.0 Alexandria (Olympus)
  383. {$IFDEF VER350}
  384. {$DEFINE VCL_11}
  385. {$IFDEF CBUILDER}
  386. {$DEFINE CBUILDER_11}
  387. {$ELSE}
  388. {$DEFINE DELPHI_11}
  389. {$ENDIF}
  390. {$ENDIF}
  391. //Delphi & CBuilder 12.0 Athens (Yukon)
  392. {$IFDEF VER360}
  393. {$DEFINE VCL_12}
  394. {$IFDEF CBUILDER}
  395. {$DEFINE CBUILDER_12}
  396. {$ELSE}
  397. {$DEFINE DELPHI_12}
  398. {$ENDIF}
  399. {$ENDIF}
  400. //Delphi & CBuilder 13.0+ (?)
  401. {$IFDEF CONDITIONALEXPRESSIONS}
  402. {$IF CompilerVersion >= 37}
  403. {$MESSAGE WARN 'Unknown compiler version detected! Assuming >= 13.x '}
  404. {$DEFINE VCL_UNKNOWN_VERSION}
  405. {$DEFINE VCL_13}
  406. {$IFDEF CBUILDER}
  407. {$DEFINE CBUILDER_13}
  408. {$ELSE}
  409. {$DEFINE DELPHI_13}
  410. {$ENDIF}
  411. {$IFEND}
  412. {$ENDIF}
  413. // Kylix
  414. //
  415. //Important: Don't use CompilerVersion here as IF's are evaluated before
  416. //IFDEF's and Kylix 1 does not have CompilerVersion defined at all.
  417. {$IFDEF LINUX}
  418. {$DEFINE UNIX}
  419. {$IFDEF CONDITIONALEXPRESSIONS}
  420. {$IF (RTLVersion >= 14.0) and (RTLVersion <= 14.5) }
  421. {$DEFINE KYLIX}
  422. {$IF RTLVersion = 14.5}
  423. {$DEFINE KYLIX_3}
  424. {$ELSEIF RTLVersion >= 14.2}
  425. {$DEFINE KYLIX_2}
  426. {$ELSE}
  427. {$DEFINE KYLIX_1}
  428. {$IFEND}
  429. {$IFEND}
  430. {$ENDIF}
  431. {$ENDIF}
  432. {$ENDIF}
  433. // Delphi.NET
  434. // Covers D8+
  435. {$IFDEF CIL}
  436. // Platform specific conditional. Used for platform specific code.
  437. {$DEFINE DOTNET}
  438. {$DEFINE STRING_IS_UNICODE}
  439. {$DEFINE STRING_IS_IMMUTABLE}
  440. {.$DEFINE HAS_Int8}
  441. {.$DEFINE HAS_UInt8}
  442. {$DEFINE HAS_Int16}
  443. {$DEFINE HAS_UInt16}
  444. {$DEFINE HAS_Int32}
  445. {$DEFINE HAS_UInt32}
  446. {$DEFINE HAS_UInt64}
  447. {$ENDIF}
  448. {$IFDEF KYLIX}
  449. {$DEFINE VCL_60}
  450. {$DEFINE INT_THREAD_PRIORITY}
  451. {$DEFINE CPUI386}
  452. {$UNDEF USE_BASEUNIX}
  453. {$IFDEF KYLIX_3}
  454. {$DEFINE KYLIX_3_OR_ABOVE}
  455. {$ENDIF}
  456. {$IFDEF KYLIX_3_OR_ABOVE}
  457. {$DEFINE KYLIX_2_OR_ABOVE}
  458. {$ELSE}
  459. {$IFDEF KYLIX_2}
  460. {$DEFINE KYLIX_2_OR_ABOVE}
  461. {$ENDIF}
  462. {$ENDIF}
  463. {$IFDEF KYLIX_2_OR_ABOVE}
  464. {$DEFINE KYLIX_1_OR_ABOVE}
  465. {$ELSE}
  466. {$IFDEF KYLIX_1}
  467. {$DEFINE KYLIX_1_OR_ABOVE}
  468. {$ENDIF}
  469. {$ENDIF}
  470. {$IFNDEF KYLIX_3_OR_ABOVE}
  471. {$DEFINE KYLIXCOMPAT}
  472. {$ENDIF}
  473. {$IFDEF KYLIX_2_OR_ABOVE}
  474. {$DEFINE USE_ZLIB_UNIT}
  475. {$ENDIF}
  476. {$ENDIF}
  477. // FPC (2+)
  478. {$IFDEF FPC}
  479. // TODO: In FreePascal 4.2.0+, a Delphi-like UnicodeString type is supported.
  480. // However, String/(P)Char do not map to UnicodeString/(P)WideChar unless
  481. // either {$MODE DelphiUnicode} or {$MODESWITCH UnicodeStrings} is used.
  482. // We should consider enabling one of them so Indy uses the same Unicode logic
  483. // in Delphi 2009+ and FreePascal 4.2.0+ and reduces IFDEFs (in particular,
  484. // STRING_UNICODE_MISMATCH, see further below). However, FreePascal's RTL
  485. // is largely not UnicodeString-enabled yet. Maybe we should enable
  486. // {$MODE DelphiUnicode} anyway, and then deal with any RTL function issues
  487. // on an as-needed basis...
  488. {$MODE Delphi}
  489. //note that we may need further defines for widget types depending on
  490. //what we do and what platforms we support in FPC.
  491. //I'll let Marco think about that one.
  492. {$IFDEF UNIX}
  493. {$DEFINE USE_BASEUNIX}
  494. {$IFDEF LINUX}
  495. //In Linux for I386, you can choose between a Kylix-libc API or
  496. //the standard RTL Unix API. Just pass -dKYLIXCOMPAT to the FPC compiler.
  497. //I will see what I can do about the Makefile.
  498. {$IFDEF KYLIXCOMPAT}
  499. {$IFDEF CPUI386}
  500. {$UNDEF USE_BASEUNIX}
  501. {$ENDIF}
  502. {$ENDIF}
  503. {$ENDIF}
  504. {$IFDEF USE_BASEUNIX}
  505. {$UNDEF KYLIXCOMPAT}
  506. {$ENDIF}
  507. {$ENDIF}
  508. // FPC_FULLVERSION was added in FPC 2.2.4
  509. // Have to use Defined() or else Delphi compiler chokes, since it
  510. // evaluates $IF statements before $IFDEF statements...
  511. {$MACRO ON} // must be on in order to use versioning macros
  512. {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30101)}
  513. {$DEFINE FPC_3_1_1_OR_ABOVE}
  514. {$IFEND}
  515. {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30000)}
  516. {$DEFINE FPC_3_0_0_OR_ABOVE}
  517. {$IFEND}
  518. {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 20701)}
  519. {$DEFINE FPC_2_7_1_OR_ABOVE}
  520. {$IFEND}
  521. {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 20604)}
  522. {$DEFINE FPC_2_6_4_OR_ABOVE}
  523. {$IFEND}
  524. {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 20602)}
  525. {$DEFINE FPC_2_6_2_OR_ABOVE}
  526. {$IFEND}
  527. {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 20600)}
  528. {$DEFINE FPC_2_6_0_OR_ABOVE}
  529. {$IFEND}
  530. {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 20404)}
  531. {$DEFINE FPC_2_4_4_OR_ABOVE}
  532. {$IFEND}
  533. {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 20402)}
  534. {$DEFINE FPC_2_4_2_OR_ABOVE}
  535. {$IFEND}
  536. {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 20400)}
  537. {$DEFINE FPC_2_4_0_OR_ABOVE}
  538. {$IFEND}
  539. {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 20204)}
  540. {$DEFINE FPC_2_2_4_OR_ABOVE}
  541. {$IFEND}
  542. {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 20202)}
  543. {$DEFINE FPC_2_2_2_OR_ABOVE}
  544. {$IFEND}
  545. {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 20105)}
  546. {$DEFINE FPC_2_1_5_OR_ABOVE}
  547. {$IFEND}
  548. // just in case
  549. {$IFDEF FPC_3_1_1}
  550. {$DEFINE FPC_3_1_1_OR_ABOVE}
  551. {$ENDIF}
  552. {$IFDEF FPC_3_0_0}
  553. {$DEFINE FPC_3_0_0_OR_ABOVE}
  554. {$ENDIF}
  555. {$IFDEF FPC_2_7_1}
  556. {$DEFINE FPC_2_7_1_OR_ABOVE}
  557. {$ENDIF}
  558. {$IFDEF FPC_2_6_4}
  559. {$DEFINE FPC_2_6_4_OR_ABOVE}
  560. {$ENDIF}
  561. {$IFDEF FPC_2_6_2}
  562. {$DEFINE FPC_2_6_2_OR_ABOVE}
  563. {$ENDIF}
  564. {$IFDEF FPC_2_6_0}
  565. {$DEFINE FPC_2_6_0_OR_ABOVE}
  566. {$ENDIF}
  567. {$IFDEF FPC_2_4_4}
  568. {$DEFINE FPC_2_4_4_OR_ABOVE}
  569. {$ENDIF}
  570. {$IFDEF FPC_2_4_2}
  571. {$DEFINE FPC_2_4_2_OR_ABOVE}
  572. {$ENDIF}
  573. {$IFDEF FPC_2_4_0}
  574. {$DEFINE FPC_2_4_0_OR_ABOVE}
  575. {$ENDIF}
  576. {$IFDEF FPC_2_2_4}
  577. {$DEFINE FPC_2_2_4_OR_ABOVE}
  578. {$ENDIF}
  579. {$IFDEF FPC_2_2_2}
  580. {$DEFINE FPC_2_2_2_OR_ABOVE}
  581. {$ENDIF}
  582. {$IFDEF FPC_2_1_5}
  583. {$DEFINE FPC_2_1_5_OR_ABOVE}
  584. {$ENDIF}
  585. {$IFDEF FPC_3_1_1_OR_ABOVE}
  586. {$DEFINE FPC_3_0_0_OR_ABOVE}
  587. {$ELSE}
  588. {$IFDEF FPC_3_0_0}
  589. {$DEFINE FPC_3_0_0_OR_ABOVE}
  590. {$ENDIF}
  591. {$ENDIF}
  592. {$IFDEF FPC_3_0_0_OR_ABOVE}
  593. {$DEFINE FPC_2_7_1_OR_ABOVE}
  594. {$ELSE}
  595. {$IFDEF FPC_2_7_1}
  596. {$DEFINE FPC_2_7_1_OR_ABOVE}
  597. {$ENDIF}
  598. {$ENDIF}
  599. {$IFDEF FPC_2_7_1_OR_ABOVE}
  600. {$DEFINE FPC_2_6_4_OR_ABOVE}
  601. {$ELSE}
  602. {$IFDEF FPC_2_6_4}
  603. {$DEFINE FPC_2_6_4_OR_ABOVE}
  604. {$ENDIF}
  605. {$ENDIF}
  606. {$IFDEF FPC_2_6_4_OR_ABOVE}
  607. {$DEFINE FPC_2_6_2_OR_ABOVE}
  608. {$ELSE}
  609. {$IFDEF FPC_2_6_2}
  610. {$DEFINE FPC_2_6_2_OR_ABOVE}
  611. {$ENDIF}
  612. {$ENDIF}
  613. {$IFDEF FPC_2_6_2_OR_ABOVE}
  614. {$DEFINE FPC_2_6_0_OR_ABOVE}
  615. {$ELSE}
  616. {$IFDEF FPC_2_6_0}
  617. {$DEFINE FPC_2_6_0_OR_ABOVE}
  618. {$ENDIF}
  619. {$ENDIF}
  620. {$IFDEF FPC_2_6_0_OR_ABOVE}
  621. {$DEFINE FPC_2_4_4_OR_ABOVE}
  622. {$ELSE}
  623. {$IFDEF FPC_2_4_4}
  624. {$DEFINE FPC_2_4_4_OR_ABOVE}
  625. {$ENDIF}
  626. {$ENDIF}
  627. {$IFDEF FPC_2_4_4_OR_ABOVE}
  628. {$DEFINE FPC_2_4_2_OR_ABOVE}
  629. {$ELSE}
  630. {$IFDEF FPC_2_4_2}
  631. {$DEFINE FPC_2_4_2_OR_ABOVE}
  632. {$ENDIF}
  633. {$ENDIF}
  634. {$IFDEF FPC_2_4_2_OR_ABOVE}
  635. {$DEFINE FPC_2_4_0_OR_ABOVE}
  636. {$ELSE}
  637. {$IFDEF FPC_2_4_0}
  638. {$DEFINE FPC_2_4_0_OR_ABOVE}
  639. {$ENDIF}
  640. {$ENDIF}
  641. {$IFDEF FPC_2_4_0_OR_ABOVE}
  642. {$DEFINE FPC_2_2_4_OR_ABOVE}
  643. {$ELSE}
  644. {$IFDEF FPC_2_2_4}
  645. {$DEFINE FPC_2_2_4_OR_ABOVE}
  646. {$ENDIF}
  647. {$ENDIF}
  648. {$IFDEF FPC_2_2_4_OR_ABOVE}
  649. {$DEFINE FPC_2_2_2_OR_ABOVE}
  650. {$ELSE}
  651. {$IFDEF FPC_2_2_2}
  652. {$DEFINE FPC_2_2_2_OR_ABOVE}
  653. {$ENDIF}
  654. {$ENDIF}
  655. {$IFDEF FPC_2_2_2_OR_ABOVE}
  656. {$DEFINE FPC_2_2_0_OR_ABOVE}
  657. {$ELSE}
  658. {$IFDEF VER2_2}
  659. {$DEFINE FPC_2_2_0_OR_ABOVE}
  660. {$ENDIF}
  661. {$ENDIF}
  662. {$IFDEF FPC_2_2_0_OR_ABOVE}
  663. {$DEFINE FPC_2_1_5_OR_ABOVE}
  664. {$ELSE}
  665. {$IFDEF FPC_2_1_5}
  666. {$DEFINE FPC_2_1_5_OR_ABOVE}
  667. {$ENDIF}
  668. {$ENDIF}
  669. {.$IFDEF FPC_2_7_1_OR_ABOVE}
  670. // support for RawByteString and UnicodeString
  671. {.$MODE DelphiUnicode}
  672. {.$MODESWITCH UnicodeStrings}
  673. {.$CODEPAGE UTF8} // needed for Unicode string literals to work properly
  674. {.$DEFINE VCL_2009}
  675. {.$DEFINE DELPHI_2009}
  676. {.$ELSE}
  677. {$DEFINE VCL_70}
  678. {$DEFINE DELPHI_7}
  679. {.$ENDIF}
  680. {$ENDIF}
  681. // end FPC
  682. {$IFDEF VCL_13}
  683. {$DEFINE VCL_13_OR_ABOVE}
  684. {$ENDIF}
  685. {$IFDEF VCL_13_OR_ABOVE}
  686. {$DEFINE VCL_12_OR_ABOVE}
  687. {$ELSE}
  688. {$IFDEF VCL_12}
  689. {$DEFINE VCL_12_OR_ABOVE}
  690. {$ENDIF}
  691. {$ENDIF}
  692. {$IFDEF VCL_12_OR_ABOVE}
  693. {$DEFINE VCL_11_OR_ABOVE}
  694. {$ELSE}
  695. {$IFDEF VCL_11}
  696. {$DEFINE VCL_11_OR_ABOVE}
  697. {$ENDIF}
  698. {$ENDIF}
  699. {$IFDEF VCL_11_OR_ABOVE}
  700. {$DEFINE VCL_10_4_OR_ABOVE}
  701. {$DEFINE VCL_10_4_UPDATE2_OR_ABOVE}
  702. {$ELSE}
  703. {$IFDEF VCL_10_4}
  704. {$DEFINE VCL_10_4_OR_ABOVE}
  705. // TODO: figure out how to detect this version
  706. {.$DEFINE VCL_10_4_UPDATE2_OR_ABOVE}
  707. {$ENDIF}
  708. {$ENDIF}
  709. {$IFDEF VCL_10_4_OR_ABOVE}
  710. {$DEFINE VCL_10_3_OR_ABOVE}
  711. {$DEFINE VCL_10_3_UPDATE2_OR_ABOVE}
  712. {$ELSE}
  713. {$IFDEF VCL_10_3}
  714. {$DEFINE VCL_10_3_OR_ABOVE}
  715. // TODO: figure out how to detect this version
  716. {.$DEFINE VCL_10_3_UPDATE2_OR_ABOVE}
  717. {$ENDIF}
  718. {$ENDIF}
  719. {$IFDEF VCL_10_3_OR_ABOVE}
  720. {$DEFINE VCL_10_2_OR_ABOVE}
  721. {$ELSE}
  722. {$IFDEF VCL_10_2}
  723. {$DEFINE VCL_10_2_OR_ABOVE}
  724. {$ENDIF}
  725. {$ENDIF}
  726. {$IFDEF VCL_10_2_OR_ABOVE}
  727. {$DEFINE VCL_10_1_OR_ABOVE}
  728. {$ELSE}
  729. {$IFDEF VCL_10_1}
  730. {$DEFINE VCL_10_1_OR_ABOVE}
  731. {$ENDIF}
  732. {$ENDIF}
  733. {$IFDEF VCL_10_1_OR_ABOVE}
  734. {$DEFINE VCL_10_0_OR_ABOVE}
  735. {$ELSE}
  736. {$IFDEF VCL_10_0}
  737. {$DEFINE VCL_10_0_OR_ABOVE}
  738. {$ENDIF}
  739. {$ENDIF}
  740. {$IFDEF VCL_10_0_OR_ABOVE}
  741. {$DEFINE VCL_XE8_OR_ABOVE}
  742. {$ELSE}
  743. {$IFDEF VCL_XE8}
  744. {$DEFINE VCL_XE8_OR_ABOVE}
  745. {$ENDIF}
  746. {$ENDIF}
  747. {$IFDEF VCL_XE8_OR_ABOVE}
  748. {$DEFINE VCL_XE7_OR_ABOVE}
  749. {$ELSE}
  750. {$IFDEF VCL_XE7}
  751. {$DEFINE VCL_XE7_OR_ABOVE}
  752. {$ENDIF}
  753. {$ENDIF}
  754. {$IFDEF VCL_XE7_OR_ABOVE}
  755. {$DEFINE VCL_XE6_OR_ABOVE}
  756. {$ELSE}
  757. {$IFDEF VCL_XE6}
  758. {$DEFINE VCL_XE6_OR_ABOVE}
  759. {$ENDIF}
  760. {$ENDIF}
  761. {$IFDEF VCL_XE6_OR_ABOVE}
  762. {$DEFINE VCL_XE5_OR_ABOVE}
  763. {$DEFINE VCL_XE5_UPDATE2_OR_ABOVE}
  764. {$ELSE}
  765. {$IFDEF VCL_XE5}
  766. {$DEFINE VCL_XE5_OR_ABOVE}
  767. // TODO: figure out how to detect this version
  768. {.$DEFINE VCL_XE5_UPDATE2_OR_ABOVE}
  769. {$ENDIF}
  770. {$ENDIF}
  771. {$IFDEF VCL_XE5_OR_ABOVE}
  772. {$DEFINE VCL_XE4_OR_ABOVE}
  773. {$ELSE}
  774. {$IFDEF VCL_XE4}
  775. {$DEFINE VCL_XE4_OR_ABOVE}
  776. {$ENDIF}
  777. {$ENDIF}
  778. {$IFDEF VCL_XE4_OR_ABOVE}
  779. {$DEFINE VCL_XE3_OR_ABOVE}
  780. {$ELSE}
  781. {$IFDEF VCL_XE3}
  782. {$DEFINE VCL_XE3_OR_ABOVE}
  783. {$ENDIF}
  784. {$ENDIF}
  785. {$IFDEF VCL_XE3_OR_ABOVE}
  786. {$DEFINE VCL_XE2_OR_ABOVE}
  787. {$ELSE}
  788. {$IFDEF VCL_XE2}
  789. {$DEFINE VCL_XE2_OR_ABOVE}
  790. {$ENDIF}
  791. {$ENDIF}
  792. {$IFDEF VCL_XE2_OR_ABOVE}
  793. {$DEFINE VCL_XE_OR_ABOVE}
  794. {$ELSE}
  795. {$IFDEF VCL_XE}
  796. {$DEFINE VCL_XE_OR_ABOVE}
  797. {$ENDIF}
  798. {$ENDIF}
  799. {$IFDEF VCL_XE_OR_ABOVE}
  800. {$DEFINE VCL_2010_OR_ABOVE}
  801. {$ELSE}
  802. {$IFDEF VCL_2010}
  803. {$DEFINE VCL_2010_OR_ABOVE}
  804. {$ENDIF}
  805. {$ENDIF}
  806. {$IFDEF VCL_2010_OR_ABOVE}
  807. {$DEFINE VCL_2009_OR_ABOVE}
  808. {$ELSE}
  809. {$IFDEF VCL_2009}
  810. {$DEFINE VCL_2009_OR_ABOVE}
  811. {$ENDIF}
  812. {$ENDIF}
  813. {$IFDEF VCL_2009_OR_ABOVE}
  814. {$DEFINE VCL_2007_OR_ABOVE}
  815. {$ELSE}
  816. {$IFDEF VCL_2007}
  817. {$DEFINE VCL_2007_OR_ABOVE}
  818. {$ENDIF}
  819. {$ENDIF}
  820. {$IFDEF VCL_2007_OR_ABOVE}
  821. {$DEFINE VCL_2006_OR_ABOVE}
  822. {$ELSE}
  823. {$IFDEF VCL_2006}
  824. {$DEFINE VCL_2006_OR_ABOVE}
  825. {$ENDIF}
  826. {$ENDIF}
  827. {$IFDEF VCL_2006_OR_ABOVE}
  828. {$DEFINE VCL_2005_OR_ABOVE}
  829. {$ELSE}
  830. {$IFDEF VCL_2005}
  831. {$DEFINE VCL_2005_OR_ABOVE}
  832. {$ENDIF}
  833. {$ENDIF}
  834. {$IFDEF VCL_2005_OR_ABOVE}
  835. {$DEFINE VCL_8_OR_ABOVE}
  836. {$ELSE}
  837. {$IFDEF VCL_80}
  838. {$DEFINE VCL_8_OR_ABOVE}
  839. {$ENDIF}
  840. {$ENDIF}
  841. {$IFDEF VCL_8_OR_ABOVE}
  842. {$DEFINE VCL_7_OR_ABOVE}
  843. {$ELSE}
  844. {$IFDEF VCL_70}
  845. {$DEFINE VCL_7_OR_ABOVE}
  846. {$ENDIF}
  847. {$ENDIF}
  848. {$IFDEF VCL_7_OR_ABOVE}
  849. {$DEFINE VCL_6_OR_ABOVE}
  850. {$ELSE}
  851. {$IFDEF VCL_60}
  852. {$DEFINE VCL_6_OR_ABOVE}
  853. {$ENDIF}
  854. {$ENDIF}
  855. {$IFDEF VCL_6_OR_ABOVE}
  856. {$DEFINE VCL_5_OR_ABOVE}
  857. {$ELSE}
  858. {$IFDEF VCL_50}
  859. {$DEFINE VCL_5_OR_ABOVE}
  860. {$ENDIF}
  861. {$ENDIF}
  862. {$IFDEF VCL_5_OR_ABOVE}
  863. {$DEFINE VCL_4_OR_ABOVE}
  864. {$ELSE}
  865. {$IFDEF VCL_40}
  866. {$DEFINE VCL_4_OR_ABOVE}
  867. {$ENDIF}
  868. {$ENDIF}
  869. // Normalize Delphi compiler defines to match FPC for consistency:
  870. //
  871. // CPU32 - any 32-bit CPU
  872. // CPU64 - any 64-bit CPU
  873. // WINDOWS - any Windows platform (32-bit, 64-bit, CE)
  874. // WIN32 - Windows 32-bit
  875. // WIN64 - Windows 64-bit
  876. // WINCE - Windows CE
  877. //
  878. // Consult the "Free Pascal Programmer's Guide", Appendix G for the complete
  879. // list of defines that are used. Do not work on this unless you understand
  880. // what the FreePascal developers are doing. Not only do you have to
  881. // descriminate with operating systems, but also with chip architectures
  882. // are well.
  883. //
  884. // DCC Pulsar+ define the following values:
  885. // ASSEMBLER
  886. // DCC
  887. // CONDITIONALEXPRESSIONS
  888. // NATIVECODE
  889. // UNICODE
  890. // MACOS
  891. // MACOS32
  892. // MACOS64
  893. // MSWINDOWS
  894. // WIN32
  895. // WIN64
  896. // LINUX
  897. // POSIX
  898. // POSIX32
  899. // CPU386
  900. // CPUX86
  901. // CPUX64
  902. //
  903. // Kylix defines the following values:
  904. // LINUX
  905. // (others??)
  906. //
  907. {$IFNDEF FPC}
  908. // TODO: We need to use ENDIAN_BIG for big endian chip architectures,
  909. // such as 680x0, PowerPC, Sparc, and MIPS, once DCC supports them,
  910. // provided it does not already define its own ENDIAN values by then...
  911. {$DEFINE ENDIAN_LITTLE}
  912. {$IFNDEF VCL_6_OR_ABOVE}
  913. {$DEFINE MSWINDOWS}
  914. {$ENDIF}
  915. {$IFDEF MSWINDOWS}
  916. {$DEFINE WINDOWS}
  917. {$ENDIF}
  918. // TODO: map Pulsar's non-Windows platform defines...
  919. {$IFDEF VCL_XE2_OR_ABOVE}
  920. {$IFDEF VCL_XE8_OR_ABOVE}
  921. {$IFDEF CPU32BITS}
  922. //any 32-bit CPU
  923. {$DEFINE CPU32}
  924. {$ENDIF}
  925. {$IFDEF CPU64BITS}
  926. {$DEFINE CPU64}
  927. {$ENDIF}
  928. {$ELSE}
  929. {$IFDEF CPU386}
  930. //any 32-bit CPU
  931. {$DEFINE CPU32}
  932. //Intel 386 compatible chip architecture
  933. {$DEFINE CPUI386}
  934. {$ENDIF}
  935. {$IFDEF CPUX86}
  936. {$DEFINE CPU32}
  937. {$ENDIF}
  938. {$IFDEF CPUX64}
  939. //any 64-bit CPU
  940. {$DEFINE CPU64}
  941. //AMD64 compatible chip architecture
  942. {$DEFINE CPUX86_64} //historical name for AMD64
  943. {$DEFINE CPUAMD64}
  944. {$ENDIF}
  945. {$ENDIF}
  946. {$ELSE}
  947. {$IFNDEF DOTNET}
  948. {$IFNDEF KYLIX}
  949. {$DEFINE I386}
  950. {$ENDIF}
  951. {$ENDIF}
  952. {$DEFINE CPU32}
  953. {$ENDIF}
  954. {$ENDIF}
  955. {$IFDEF DOTNET}
  956. //differences in DotNET Framework versions.
  957. {$IFDEF VCL_2007_OR_ABOVE}
  958. {$DEFINE DOTNET_2}
  959. {$DEFINE DOTNET_2_OR_ABOVE}
  960. {$ELSE}
  961. {$DEFINE DOTNET_1_1}
  962. {$ENDIF}
  963. {$DEFINE DOTNET_1_1_OR_ABOVE}
  964. // Extra include used in D7 for testing. Remove later when all comps are
  965. // ported. Used to selectively exclude non ported parts. Allowed in places
  966. // IFDEFs are otherwise not permitted.
  967. {$DEFINE DOTNET_EXCLUDE}
  968. {$ENDIF}
  969. // Check for available features
  970. {$IFDEF CBUILDER}
  971. // When generating a C++ HPP file, if a class has no explicit constructor
  972. // defined and contains compiler-managed members (xxxString, TDateTime,
  973. // Variant, DelphiInterface, etc), the HPP will contain a forwarding
  974. // inline constructor that implicitly initializes those managed members,
  975. // which will overwrite any non-default initializations performed inside
  976. // of InitComponent() overrides! In this situation, the workaround is to
  977. // define an explicit constructor that calls the base class constructor
  978. // manually, allowing those managed members to be initialized by the
  979. // compiler before InitComponent() overrides then re-assign them.
  980. {$DEFINE WORKAROUND_INLINE_CONSTRUCTORS}
  981. {$ENDIF}
  982. {$IFDEF VCL_5_OR_ABOVE}
  983. {$IFNDEF FPC}
  984. {$IFNDEF KYLIX}
  985. {$DEFINE HAS_RemoveFreeNotification}
  986. {$ENDIF}
  987. // In Delphi 5 only, there are some really nasty bugs in the compiler and IDE that affect Indy:
  988. //
  989. // - when a class method is overloaded, and one of the overloads has an open array parameter, the
  990. // compiler produces bad codegen that corrupts the call stack. This affects many methods in Indy,
  991. // particularly the CheckResponse(), GetResponse(), and SendCmd() methods of TIdTCPConnection, which
  992. // are used in many Indy components.
  993. //
  994. // - at design-time, the TransparentProxy property getter of TIdUDPClient and TIdIOHandlerSocket
  995. // causes a Stack Overflow error when the default TIdSocksInfo is created. When the Object
  996. // Inspector is open, the getter gets called recursively, and I don't know why. But even weirder,
  997. // if the getter doesn't do anything and just returns nil, the error still happens! Support for
  998. // nested components was first added in Delphi 6, so this might be a side-effect of that missing
  999. // support in Delphi 5. So, lets disable the getters. Whatever "SOAP support" the getters were
  1000. // needed for, do they really matter anymore?
  1001. //
  1002. // These issues were fixed in Delphi 6.
  1003. {$IFDEF VCL_50}
  1004. {$DEFINE OVERLOADED_OPENARRAY_BUG}
  1005. {$DEFINE TRANSPARENTPROXY_GETTER_BUG}
  1006. {$ENDIF}
  1007. {$ENDIF}
  1008. {$DEFINE HAS_GetObjectProp}
  1009. {$DEFINE HAS_TObjectList}
  1010. {$DEFINE HAS_StrToInt64Def}
  1011. {$ENDIF}
  1012. {$IFDEF VCL_6_OR_ABOVE}
  1013. {$DEFINE HAS_PCardinal}
  1014. {$DEFINE HAS_PByte}
  1015. {$DEFINE HAS_PWord}
  1016. {$DEFINE HAS_PPointer}
  1017. {$DEFINE HAS_TList_Assign}
  1018. {$DEFINE HAS_sLineBreak}
  1019. {$DEFINE HAS_RaiseLastOSError}
  1020. {$DEFINE HAS_SysUtils_IncludeExcludeTrailingPathDelimiter}
  1021. {$DEFINE HAS_SysUtils_DirectoryExists}
  1022. {$DEFINE HAS_UNIT_DateUtils}
  1023. {$DEFINE HAS_UNIT_StrUtils}
  1024. {$DEFINE HAS_UNIT_Types}
  1025. {$DEFINE HAS_TryStrToInt}
  1026. {$DEFINE HAS_TryStrToInt64}
  1027. {$DEFINE HAS_TryEncodeDate}
  1028. {$DEFINE HAS_TryEncodeTime}
  1029. {$DEFINE HAS_ENUM_ELEMENT_VALUES}
  1030. {$IFNDEF FPC}
  1031. {$DEFINE HAS_IInterface}
  1032. {$DEFINE HAS_TSelectionEditor}
  1033. {$DEFINE HAS_TStringList_CaseSensitive}
  1034. {$DEFINE HAS_AcquireExceptionObject}
  1035. {$IFNDEF KYLIX}
  1036. {$DEFINE HAS_DEPRECATED}
  1037. {$DEFINE HAS_SYMBOL_PLATFORM}
  1038. {$DEFINE HAS_UNIT_PLATFORM}
  1039. {$IFNDEF VCL_8_OR_ABOVE}
  1040. // Delphi 6 and 7 have an annoying bug that if a class method is declared as
  1041. // deprecated, the compiler will emit a "symbol is deprecated" warning
  1042. // on the method's implementation! So we will have to wrap implementations
  1043. // of deprecated methods with {$WARN SYMBOL_DEPRECATED OFF} directives
  1044. // to disable that warning.
  1045. {$DEFINE DEPRECATED_IMPL_BUG}
  1046. {$ENDIF}
  1047. {$ENDIF}
  1048. {$ENDIF}
  1049. {$IFNDEF DOTNET}
  1050. //Widget defines are omitted in .NET
  1051. {$DEFINE VCL_60_PLUS}
  1052. {$ENDIF}
  1053. {$ENDIF}
  1054. {$IFDEF VCL_7_OR_ABOVE}
  1055. {$IFNDEF FPC}
  1056. {$DEFINE HAS_UInt64} // Note: it was just an alias for Int64 until D2006!
  1057. {$DEFINE HAS_NAMED_THREADS}
  1058. {$DEFINE HAS_TStrings_NameValueSeparator}
  1059. {$DEFINE HAS_TStrings_ValueFromIndex}
  1060. {$ENDIF}
  1061. {$DEFINE HAS_TFormatSettings}
  1062. {$DEFINE HAS_PosEx}
  1063. {$IFNDEF VCL_70}
  1064. // not implemented in D7
  1065. {$DEFINE HAS_STATIC_TThread_Queue}
  1066. {$ENDIF}
  1067. {$IFNDEF CIL}
  1068. {$IFNDEF VCL_80}
  1069. // not implemented in D8 or .NET
  1070. {$DEFINE HAS_STATIC_TThread_Synchronize}
  1071. {$ENDIF}
  1072. {$ENDIF}
  1073. {$ELSE}
  1074. {$IFDEF CBUILDER_6}
  1075. {$DEFINE HAS_NAMED_THREADS}
  1076. {$ENDIF}
  1077. {$ENDIF}
  1078. {$IFNDEF VCL_2005_OR_ABOVE}
  1079. {$IFDEF DCC}
  1080. // InterlockedCompareExchange() was declared in the Windows unit using Pointer
  1081. // parameters until Delphi 2005, when it was switched to Longint parameters
  1082. // instead to match the actual Win32 API declaration.
  1083. {$DEFINE HAS_InterlockedCompareExchange_Pointers}
  1084. {$ENDIF}
  1085. {$ENDIF}
  1086. {$IFDEF VCL_2006_OR_ABOVE}
  1087. {$DEFINE USE_INLINE}
  1088. {$DEFINE HAS_2PARAM_FileAge}
  1089. {$DEFINE HAS_TStrings_LineBreak} // TODO: when was LineBreak introduced?
  1090. {$IFDEF WINDOWS}
  1091. // System.RegisterExpectedMemoryLeak() is only available on Windows at this time
  1092. {$DEFINE HAS_System_RegisterExpectedMemoryLeak}
  1093. {$ENDIF}
  1094. // In C++Builder 2006 and 2007, UInt64 is emitted as signed __int64 in HPP
  1095. // files instead of as unsigned __int64. This causes conflicts in overloaded
  1096. // routines that have (U)Int64 parameters. This was fixed in C++Builder 2009...
  1097. {$IFDEF CBUILDER}
  1098. {$DEFINE BROKEN_UINT64_HPPEMIT}
  1099. {$ENDIF}
  1100. {$ENDIF}
  1101. {$IFDEF VCL_2007_OR_ABOVE}
  1102. {$IFNDEF CBUILDER_2007}
  1103. // class properties are broken in C++Builder 2007, causing AVs at compile-time
  1104. {$DEFINE HAS_CLASSPROPERTIES}
  1105. {$ENDIF}
  1106. // Native(U)Int exist but are buggy, so do not use them yet
  1107. {.$DEFINE HAS_NativeInt}
  1108. {.$DEFINE HAS_NativeUInt}
  1109. {$DEFINE HAS_DWORD_PTR}
  1110. {$DEFINE HAS_ULONG_PTR}
  1111. {$DEFINE HAS_ULONGLONG}
  1112. {$DEFINE HAS_PGUID}
  1113. {$DEFINE HAS_PPAnsiChar}
  1114. {$DEFINE HAS_CurrentYear}
  1115. {$IFNDEF DOTNET}
  1116. {$DEFINE HAS_TIMEUNITS}
  1117. {$ENDIF}
  1118. {$ENDIF}
  1119. {$IFDEF VCL_2009_OR_ABOVE}
  1120. {$IFNDEF DOTNET}
  1121. {$DEFINE STRING_IS_UNICODE}
  1122. {$DEFINE HAS_UnicodeString}
  1123. {$DEFINE HAS_TEncoding}
  1124. {$DEFINE HAS_TCharacter}
  1125. {$DEFINE HAS_InterlockedCompareExchangePointer}
  1126. {$DEFINE HAS_WIDE_TCharArray}
  1127. {$DEFINE HAS_PUInt64}
  1128. {$IFDEF VCL_2009}
  1129. // TODO: need to differentiate between RTM and Update 1
  1130. // FmtStr() is broken in RTM but was fixed in Update 1
  1131. {$DEFINE BROKEN_FmtStr}
  1132. {$ENDIF}
  1133. {$ENDIF}
  1134. {$DEFINE HAS_CLASSVARS}
  1135. {$DEFINE HAS_DEPRECATED_MSG}
  1136. {$DEFINE HAS_TBytes}
  1137. // Native(U)Int are still buggy, so do not use them yet
  1138. {.$DEFINE HAS_NativeInt}
  1139. {.$DEFINE HAS_NativeUInt}
  1140. {$DEFINE HAS_Int8}
  1141. {$DEFINE HAS_UInt8}
  1142. {$DEFINE HAS_Int16}
  1143. {$DEFINE HAS_UInt16}
  1144. {$DEFINE HAS_Int32}
  1145. {$DEFINE HAS_UInt32}
  1146. {$DEFINE HAS_UIntToStr}
  1147. // UInt64 is now emitted as unsigned __int64 in HPP files
  1148. {$IFDEF CBUILDER}
  1149. {$UNDEF BROKEN_UINT64_HPPEMIT}
  1150. {$ENDIF}
  1151. {$IFDEF DCC}
  1152. {$IFDEF WINDOWS}
  1153. // Exception.RaiseOuterException() is only available on Windows at this time
  1154. {$DEFINE HAS_Exception_RaiseOuterException}
  1155. {$ENDIF}
  1156. {$ENDIF}
  1157. {$DEFINE HAS_SetCodePage}
  1158. {$DEFINE HAS_PRawByteString}
  1159. {$DEFINE HAS_TThreadProcedure}
  1160. {$ENDIF}
  1161. {$IFDEF VCL_2010_OR_ABOVE}
  1162. {$DEFINE HAS_CLASSCONSTRUCTOR}
  1163. {$DEFINE HAS_CLASSDESTRUCTOR}
  1164. {$DEFINE HAS_DELAYLOAD}
  1165. {$DEFINE HAS_TThread_NameThreadForDebugging}
  1166. {$DEFINE DEPRECATED_TThread_SuspendResume}
  1167. // Native(U)Int are finally ok to use now
  1168. {$DEFINE HAS_NativeInt}
  1169. {$DEFINE HAS_NativeUInt}
  1170. {$DEFINE HAS_USHORT}
  1171. {$DEFINE HAS_IOUtils_TPath}
  1172. {$ENDIF}
  1173. {$IFDEF VCL_XE_OR_ABOVE}
  1174. {$DEFINE HAS_TFormatSettings_Object}
  1175. {$DEFINE HAS_LocaleCharsFromUnicode}
  1176. {$DEFINE HAS_UnicodeFromLocaleChars}
  1177. {$DEFINE HAS_PLongBool}
  1178. {$DEFINE HAS_PVOID}
  1179. {$DEFINE HAS_ULONG64}
  1180. {$DEFINE HAS_TEncoding_GetEncoding_ByEncodingName}
  1181. {$DEFINE HAS_DateUtils_TTimeZone}
  1182. {$IFDEF DCC}
  1183. // Exception.RaiseOuterException() is now available on all platforms
  1184. {$DEFINE HAS_Exception_RaiseOuterException}
  1185. {$ENDIF}
  1186. {$IFNDEF DOTNET}
  1187. {$DEFINE HAS_TInterlocked}
  1188. {$ENDIF}
  1189. {$ENDIF}
  1190. {$IFDEF VCL_XE2_OR_ABOVE}
  1191. {$DEFINE HAS_SIZE_T}
  1192. {$DEFINE HAS_PSIZE_T}
  1193. {$DEFINE HAS_SSIZE_T}
  1194. {$DEFINE HAS_PSSIZE_T}
  1195. {$DEFINE HAS_LONG}
  1196. {$DEFINE HAS_ComponentPlatformsAttribute}
  1197. {$DEFINE HAS_ComponentPlatformsAttribute_Win32}
  1198. {$DEFINE HAS_ComponentPlatformsAttribute_Win64}
  1199. {$DEFINE HAS_ComponentPlatformsAttribute_OSX32}
  1200. {$DEFINE HAS_System_ReturnAddress}
  1201. {$DEFINE HAS_DIRECTIVE_WARN_DEFAULT}
  1202. {$ENDIF}
  1203. {$IFDEF VCL_XE3_OR_ABOVE}
  1204. {$DEFINE HAS_DIRECTIVE_ZEROBASEDSTRINGS}
  1205. {$DEFINE HAS_SysUtils_TStringHelper}
  1206. {$IFDEF NEXTGEN}
  1207. {$DEFINE DCC_NEXTGEN}
  1208. {$DEFINE HAS_MarshaledAString}
  1209. {$DEFINE USE_MARSHALLED_PTRS}
  1210. {$IFDEF AUTOREFCOUNT}
  1211. {$DEFINE USE_OBJECT_ARC}
  1212. {$ENDIF}
  1213. {$ENDIF}
  1214. // technically, these are present in XE3, but they are not used yet
  1215. {.$DEFINE HAS_ComponentPlatformsAttribute_iOS_Simulator}
  1216. {.$DEFINE HAS_ComponentPlatformsAttribute_Android}
  1217. {.$DEFINE HAS_ComponentPlatformsAttribute_Linux32}
  1218. {.$DEFINE HAS_ComponentPlatformsAttribute_iOS_Device}
  1219. {.$DEFINE HAS_ComponentPlatformsAttribute_WinNX32}
  1220. {$ENDIF}
  1221. {$IFDEF VCL_XE4_OR_ABOVE}
  1222. {$DEFINE HAS_AnsiStrings_StrPLCopy}
  1223. {$DEFINE HAS_AnsiStrings_StrLen}
  1224. {$DEFINE HAS_Character_TCharHelper}
  1225. {$DEFINE HAS_ComponentPlatformsAttribute_iOS_Simulator}
  1226. {$DEFINE HAS_ComponentPlatformsAttribute_iOS_Device}
  1227. {$ENDIF}
  1228. {$IFDEF VCL_XE5_OR_ABOVE}
  1229. {$DEFINE HAS_ComponentPlatformsAttribute_Android}
  1230. {$ENDIF}
  1231. {$IFDEF VCL_XE5_UPDATE2_OR_ABOVE}
  1232. {$DEFINE HAS_DIRECTIVE_HPPEMIT_LINKUNIT}
  1233. {$DEFINE HAS_DIRECTIVE_HPPEMIT_NAMESPACE}
  1234. {$ENDIF}
  1235. {$IFDEF VCL_XE7_OR_ABOVE}
  1236. {$DEFINE HAS_TNetEncoding}
  1237. {$ENDIF}
  1238. {$IFDEF VCL_XE8_OR_ABOVE}
  1239. {$DEFINE HAS_ComponentPlatformsAttribute_iOS_Device32}
  1240. {$DEFINE HAS_ComponentPlatformsAttribute_iOS_Device64}
  1241. // technically, these are present in XE8, but they are not used yet
  1242. {.$DEFINE HAS_ComponentPlatformsAttribute_Linux64}
  1243. {.$DEFINE HAS_ComponentPlatformsAttribute_WinIoT32}
  1244. {$ENDIF}
  1245. {$IFDEF VCL_10_0_OR_ABOVE}
  1246. {$IFDEF ANDROID}
  1247. {$DEFINE HAS_TAndroidHelper}
  1248. {$ENDIF}
  1249. // technically, these are present in 10.0 Seattle, but they are not used yet
  1250. {.$DEFINE HAS_ComponentPlatformsAttribute_WinARM}
  1251. {$ENDIF}
  1252. {$IFDEF VCL_10_1_OR_ABOVE}
  1253. {$DEFINE HAS_DIRECTIVE_HPPEMIT_LEGACYHPP}
  1254. {$DEFINE HAS_TStrings_AddPair}
  1255. // technically, these are present in 10.1 Berlin, but they are not used yet
  1256. {.$DEFINE HAS_ComponentPlatformsAttribute_OSX64}
  1257. {.$DEFINE HAS_ComponentPlatformsAttribute_OSXNX64}
  1258. {.$DEFINE HAS_ComponentPlatformsAttribute_Linux32Arm}
  1259. {.$DEFINE HAS_ComponentPlatformsAttribute_Linux64Arm}
  1260. {.$DEFINE HAS_ComponentPlatformsAttribute_Android64}
  1261. {$ENDIF}
  1262. {$IFDEF VCL_10_2_OR_ABOVE}
  1263. {.$WARN IMPLICIT_INTEGER_CAST_LOSS OFF}
  1264. {.$WARN IMPLICIT_CONVERSION_LOSS OFF}
  1265. {.$WARN COMBINING_SIGNED_UNSIGNED64 OFF}
  1266. {$DEFINE HAS_STATIC_TThread_ForceQueue}
  1267. // In Delphi 10.2 Tokyo, TThread.ForceQueue() is broken on Android, the
  1268. // passed in procedure is called immediately instead of being delayed!
  1269. {$IFDEF ANDROID}
  1270. {$DEFINE BROKEN_TThread_ForceQueue}
  1271. {$ENDIF}
  1272. {$ENDIF}
  1273. {$IFDEF VCL_10_3_OR_ABOVE}
  1274. {$DEFINE HAS_ComponentPlatformsAttribute_iOS_Simulator32}
  1275. {$DEFINE HAS_ComponentPlatformsAttribute_Android32Arm}
  1276. {$DEFINE HAS_ComponentPlatformsAttribute_WinARM32}
  1277. {$UNDEF HAS_ComponentPlatformsAttribute_OSXNX64} // removed in 10.3 Rio
  1278. // technically, these are present in 10.3 Rio, but they are not used yet
  1279. {.$DEFINE HAS_ComponentPlatformsAttribute_iOS_Simulator64}
  1280. {$IFDEF DCC}
  1281. {$IFDEF LINUX}
  1282. // RLebeau 9/25/2019: there is a bug in the IDE when debugging Linux projects
  1283. // where the EThreadNameException exception raised by TThread.NameThreadForDebugging()
  1284. // is not handled correctly.
  1285. {$UNDEF HAS_NAMED_THREADS}
  1286. {$ENDIF}
  1287. {$ENDIF}
  1288. {$IFDEF ANDROID}
  1289. {$UNDEF BROKEN_TThread_ForceQueue}
  1290. {$ENDIF}
  1291. {$ENDIF}
  1292. {$IFDEF VCL_10_3_UPDATE2_OR_ABOVE}
  1293. {$DEFINE HAS_ComponentPlatformsAttribute_AllPlatforms}
  1294. {$DEFINE HAS_ComponentPlatformsAttribute_OSX64}
  1295. {$ENDIF}
  1296. {$IFDEF VCL_10_4_OR_ABOVE}
  1297. // 0-based string indexing via '[]' is turned off by default in Delphi 10.4.
  1298. // TStringHelper is always 0-indexed, flat RTL functions are always 1-indexed,
  1299. // and now '[]' is 1-indexed again on all platforms - {$ZEROBASEDSTRINGS OFF}
  1300. // is the default.
  1301. {.$UNDEF HAS_DIRECTIVE_ZEROBASEDSTRINGS}
  1302. {$ENDIF}
  1303. {$IFDEF VCL_11_OR_ABOVE}
  1304. {$DEFINE HAS_ComponentPlatformsAttribute_AndroidArm32}
  1305. {$DEFINE HAS_ComponentPlatformsAttribute_AndroidArm64}
  1306. {$DEFINE HAS_ComponentPlatformsAttribute_OSXArm64}
  1307. {$ENDIF}
  1308. // Delphi XE+ cross-compiling
  1309. {$IFNDEF FPC}
  1310. {$IFDEF POSIX}
  1311. {$IF RTLVersion >= 22.0}
  1312. {$DEFINE UNIX}
  1313. {$UNDEF USE_BASEUNIX}
  1314. {$DEFINE VCL_CROSS_COMPILE}
  1315. {$DEFINE USE_VCL_POSIX}
  1316. {$IFEND}
  1317. {$ENDIF}
  1318. {$IFDEF LINUX}
  1319. {$IFDEF CONDITIONALEXPRESSIONS}
  1320. {$IF RTLVersion >= 22.0}
  1321. {$DEFINE VCL_CROSS_COMPILE}
  1322. {$DEFINE USE_VCL_POSIX}
  1323. {$IFEND}
  1324. {$ENDIF}
  1325. {$ENDIF}
  1326. {$ENDIF}
  1327. {$IFDEF VCL_CROSS_COMPILE}
  1328. {$UNDEF KYLIXCOMPAT}
  1329. {$ELSE}
  1330. {$IFDEF KYLIXCOMPAT}
  1331. {$linklib c}
  1332. {$ENDIF}
  1333. {$ENDIF}
  1334. {$IFDEF FPC}
  1335. {$DEFINE USE_INLINE}
  1336. {$DEFINE USE_CLASSINLINE}
  1337. {$DEFINE USE_TBitBtn} //use Bit Buttons instead of Buttons
  1338. {$DEFINE FPC_REINTRODUCE_BUG}
  1339. {$DEFINE FPC_CIRCULAR_BUG}
  1340. {$DEFINE NO_REDECLARE}
  1341. {$DEFINE BYTE_COMPARE_SETS}
  1342. {$DEFINE HAS_QWord} // TODO: when was QWord introduced?
  1343. {$DEFINE HAS_PQWord} // TODO: when was PQWord introduced?
  1344. {$IFDEF FPC_2_1_5_OR_ABOVE}
  1345. {$DEFINE HAS_UInt64}
  1346. {.$DEFINE HAS_PUInt64} // TODO: is this defined?
  1347. {$ENDIF}
  1348. {$IFDEF FPC_2_2_0_OR_ABOVE}
  1349. {$DEFINE HAS_InterlockedCompareExchange_Pointers}
  1350. {$ENDIF}
  1351. {$IFDEF FPC_2_2_2_OR_ABOVE}
  1352. {$DEFINE HAS_SharedSuffix}
  1353. {$ENDIF}
  1354. {$IFDEF FPC_2_2_4_OR_ABOVE}
  1355. // these types are only available on Unix systems (FreeBSD, Linux, etc)
  1356. {$IFDEF UNIX}
  1357. {$DEFINE HAS_UNIT_UnixType}
  1358. {$DEFINE HAS_SIZE_T}
  1359. {$DEFINE HAS_PSIZE_T}
  1360. {$DEFINE HAS_SSIZE_T}
  1361. {$DEFINE HAS_PSSIZE_T}
  1362. {$DEFINE HAS_TIME_T}
  1363. {$DEFINE HAS_PTIME_T}
  1364. {$ENDIF}
  1365. {$ENDIF}
  1366. {$DEFINE HAS_PtrInt}
  1367. {$DEFINE HAS_PtrUInt}
  1368. {$DEFINE HAS_PGUID}
  1369. {$DEFINE HAS_LPGUID}
  1370. {$DEFINE HAS_PPAnsiChar}
  1371. {$DEFINE HAS_ENUM_ELEMENT_VALUES}
  1372. {$DEFINE HAS_AcquireExceptionObject} // TODO: when was AcquireExceptionObject introduced?
  1373. {$IFDEF WINDOWS}
  1374. {$DEFINE HAS_ULONG_PTR}
  1375. {.$DEFINE HAS_ULONGLONG} // TODO: is this defined?
  1376. {$ENDIF}
  1377. {$DEFINE HAS_UNIT_ctypes}
  1378. {$DEFINE HAS_sLineBreak}
  1379. {$DEFINE HAS_TStrings_LineBreak} // TODO: when was LineBreak introduced?
  1380. {$IFDEF FPC_HAS_UNICODESTRING}
  1381. {$DEFINE HAS_UnicodeString}
  1382. {$ELSE}
  1383. {$IFDEF FPC_2_4_0_OR_ABOVE}
  1384. {$DEFINE HAS_UnicodeString}
  1385. {$ENDIF}
  1386. {$ENDIF}
  1387. {$IFDEF FPC_2_4_4_OR_ABOVE}
  1388. {$DEFINE DEPRECATED_TThread_SuspendResume}
  1389. {$DEFINE HAS_DEPRECATED} // TODO: when was deprecated introduced? Possibly 1.9.x
  1390. {$DEFINE HAS_DEPRECATED_MSG} // TODO: when was message support added? Possibly 2.4.x
  1391. {$DEFINE HAS_STATIC_TThread_Synchronize}
  1392. {$IFNDEF FPC_2_6_2_OR_ABOVE}
  1393. {$DEFINE USE_SEMICOLON_BEFORE_DEPRECATED} // TODO: which earlier versions require a semicolon?
  1394. {$ENDIF}
  1395. {$ENDIF}
  1396. {$IFDEF FPC_2_6_0_OR_ABOVE}
  1397. {$DEFINE HAS_NativeInt}
  1398. {$DEFINE HAS_NativeUInt}
  1399. {$ENDIF}
  1400. {$IFDEF FPC_2_6_2_OR_ABOVE}
  1401. {$DEFINE HAS_Int8}
  1402. {$DEFINE HAS_UInt8}
  1403. {$DEFINE HAS_Int16}
  1404. {$DEFINE HAS_UInt16}
  1405. {$DEFINE HAS_Int32}
  1406. {$DEFINE HAS_UInt32}
  1407. {$DEFINE HAS_GetLocalTimeOffset}
  1408. {$DEFINE HAS_UniversalTimeToLocal}
  1409. {$DEFINE HAS_LocalTimeToUniversal}
  1410. {$ENDIF}
  1411. {$IFDEF FPC_2_6_4_OR_ABOVE}
  1412. {$DEFINE HAS_PInt8}
  1413. {$DEFINE HAS_PUInt8}
  1414. {$DEFINE HAS_PInt16}
  1415. {$DEFINE HAS_PUInt16}
  1416. {$DEFINE HAS_PInt32}
  1417. {$DEFINE HAS_PUInt32}
  1418. {$ENDIF}
  1419. {$IFDEF FPC_3_0_0_OR_ABOVE}
  1420. {$DEFINE HAS_STATIC_TThread_Queue}
  1421. {$DEFINE HAS_SetCodePage}
  1422. {$ENDIF}
  1423. {$IFDEF FPC_UNICODESTRINGS}
  1424. {$DEFINE STRING_IS_UNICODE}
  1425. {$ENDIF}
  1426. {$IFDEF FPC_3_1_1_OR_ABOVE}
  1427. {$DEFINE HAS_STATIC_TThread_ForceQueue} // requires rev 37359+
  1428. {$DEFINE HAS_PRawByteString}
  1429. {$DEFINE HAS_UIntToStr} // requires rev 40529+
  1430. {$ENDIF}
  1431. {$ENDIF}
  1432. {$IFDEF DOTNET}
  1433. {$DEFINE WIDGET_WINFORMS}
  1434. {$ELSE}
  1435. {$DEFINE WIDGET_VCL_LIKE} // LCL included.
  1436. {$DEFINE WIDGET_VCL_LIKE_OR_KYLIX}
  1437. {$IFDEF FPC}
  1438. {$DEFINE WIDGET_LCL}
  1439. {$ELSE}
  1440. {$IFDEF KYLIX}
  1441. {$DEFINE WIDGET_KYLIX}
  1442. {$ELSE}
  1443. {$DEFINE WIDGET_VCL}
  1444. {$ENDIF}
  1445. {$ENDIF}
  1446. {$ENDIF}
  1447. // .NET and Delphi 2009+ support UNICODE strings natively!
  1448. //
  1449. // FreePascal 2.4.0+ supports UnicodeString, but does not map its
  1450. // native String type to UnicodeString except when {$MODE DelphiUnicode}
  1451. // or {$MODESWITCH UnicodeStrings} is enabled. However, UNICODE is not
  1452. // defined in that mode yet until its RTL has been updated to support
  1453. // UnicodeString. STRING_UNICODE_MISMATCH is defined when the native
  1454. // String/Char types do not map to the same types that APIs are expecting
  1455. // based on whether UNICODE is defined or not.
  1456. //
  1457. // NOTE: Do not define UNICODE here. The compiler defines
  1458. // the symbol automatically.
  1459. {$IFDEF STRING_IS_UNICODE}
  1460. {$IFNDEF UNICODE}
  1461. {$DEFINE STRING_UNICODE_MISMATCH}
  1462. {$ENDIF}
  1463. {$ELSE}
  1464. {$DEFINE STRING_IS_ANSI}
  1465. {$IFDEF UNICODE}
  1466. {$DEFINE STRING_UNICODE_MISMATCH}
  1467. {$ENDIF}
  1468. {$ENDIF}
  1469. {$IFDEF DCC_NEXTGEN}
  1470. {$DEFINE NO_ANSI_TYPES}
  1471. {.$DEFINE STRING_IS_IMMUTABLE} // Strings are NOT immutable in NEXTGEN yet
  1472. {$IFDEF USE_OBJECT_ARC}
  1473. // TODO: move these to an appropriate section. Not doing this yet because
  1474. // it is a major interface change to switch to Generics and we should
  1475. // maintain backwards compatibility with earlier compilers for the time
  1476. // being. Defining them only here for now because the non-Generic versions
  1477. // of these classes have become deprecated by ARC and so we need to start
  1478. // taking advantage of the Generics versions...
  1479. {$DEFINE HAS_UNIT_Generics_Collections}
  1480. {$DEFINE HAS_UNIT_Generics_Defaults}
  1481. {$DEFINE HAS_GENERICS_TDictionary}
  1482. {$DEFINE HAS_GENERICS_TList}
  1483. {$DEFINE HAS_GENERICS_TObjectList}
  1484. {$DEFINE HAS_GENERICS_TThreadList}
  1485. // TArray<T>.Copy() was introduced in XE7 but was buggy. It was fixed in XE8:
  1486. //
  1487. // RSP-9763 TArray.Copy<T> copies from destination to source for unmanaged types
  1488. // https://quality.embarcadero.com/browse/RSP-9763
  1489. //
  1490. {$IFDEF VCL_XE8_OR_ABOVE}
  1491. {$DEFINE HAS_GENERICS_TArray_Copy}
  1492. {$ENDIF}
  1493. {$ENDIF}
  1494. {$ENDIF}
  1495. // TODO: Ansi data types were disabled on mobile platforms in XE3, but
  1496. // UTF8String and RawByteString were re-enabled in 10.1 Berlin! What else,
  1497. // if anything, was re-enabled to facilitate that?
  1498. //
  1499. // UPDATE: In 10.4 Sydney, AnsiChar and AnsiString were re-enabled on
  1500. // mobile platforms! NEXTGEN is no longer defined in the mobile compilers.
  1501. {$IFDEF NO_ANSI_TYPES}
  1502. {$UNDEF HAS_AnsiString}
  1503. {$UNDEF HAS_AnsiChar}
  1504. {$UNDEF HAS_PAnsiChar}
  1505. {$UNDEF HAS_PPAnsiChar}
  1506. {$UNDEF HAS_AnsiStrings_StrPLCopy}
  1507. {$UNDEF HAS_AnsiStrings_StrLen}
  1508. {$ENDIF}
  1509. {$IFDEF WIN32}
  1510. {$DEFINE WIN32_OR_WIN64}
  1511. {$ENDIF}
  1512. {$IFDEF WIN64}
  1513. {$DEFINE WIN32_OR_WIN64}
  1514. {$ENDIF}
  1515. {$IFDEF WIN32_OR_WIN64}
  1516. {$DEFINE USE_ZLIB_UNIT}
  1517. {$IFNDEF DCC_NEXTGEN}
  1518. {$DEFINE USE_OPENSSL} // !!! MOVED HERE BY EMBT
  1519. {$DEFINE USE_SSPI}
  1520. {$IFDEF STRING_IS_UNICODE}
  1521. {$DEFINE SSPI_UNICODE}
  1522. {$ENDIF}
  1523. {$ENDIF}
  1524. {$ENDIF}
  1525. {$IFDEF WINCE}
  1526. {$DEFINE USE_OPENSSL}
  1527. // RLebeau: not sure if the above Win32/64 defines also apply to WinCE,
  1528. // so keeping them separate for now...
  1529. {$ENDIF}
  1530. // High-performance counters are not reliable on multi-core systems, and have
  1531. // been known to cause problems with TIdIOHandler.ReadLn() timeouts in Windows
  1532. // XP SP3, both 32-bit and 64-bit. Refer to these discussions for more info:
  1533. //
  1534. // http://www.virtualdub.org/blog/pivot/entry.php?id=106
  1535. // http://blogs.msdn.com/oldnewthing/archive/2008/09/08/8931563.aspx
  1536. //
  1537. // Do not enable thus unless you know it will work correctly on your systems!
  1538. {$IFDEF WINDOWS}
  1539. {.$DEFINE USE_HI_PERF_COUNTER_FOR_TICKS}
  1540. {$ENDIF}
  1541. {$IFDEF UNIX}
  1542. {$DEFINE USE_OPENSSL}
  1543. {$DEFINE USE_ZLIB_UNIT}
  1544. {$DEFINE HAS_getifaddrs}
  1545. {$ENDIF}
  1546. {$IFDEF MACOS}
  1547. {$DEFINE HAS_getifaddrs}
  1548. {$ENDIF}
  1549. {$IFDEF DARWIN}
  1550. {$DEFINE HAS_getifaddrs}
  1551. {$ENDIF}
  1552. {$IFDEF LINUX}
  1553. {$DEFINE HAS_getifaddrs}
  1554. {$ENDIF}
  1555. {$IFDEF IOS}
  1556. {$DEFINE HAS_getifaddrs}
  1557. {$DEFINE USE_OPENSSL}
  1558. // Support for 64-bit ARM iOS Simulator was added in Delphi 11.2
  1559. // TODO: how to detect iOS Simulator in FPC? Does it support 64-bit ARM?
  1560. {$IFDEF CPUARM}
  1561. {$IFNDEF IOSSIMULATOR}
  1562. // RLebeau: For iOS devices, OpenSSL cannot be used as an external library,
  1563. // it must be statically linked into the app. For the iOS simulator, this
  1564. // is not true. Users who want to use OpenSSL in iOS device apps will need
  1565. // to add the static OpenSSL library to the project and then include the
  1566. // IdSSLOpenSSLHeaders_static unit in their uses clause. It hooks up the
  1567. // statically linked functions for the IdSSLOpenSSLHeaders unit to use...
  1568. {$DEFINE STATICLOAD_OPENSSL}
  1569. {$ENDIF}
  1570. {$ENDIF}
  1571. {$ENDIF}
  1572. {$IFDEF FREEBSD}
  1573. {$DEFINE HAS_getifaddrs}
  1574. {$ENDIF}
  1575. {$IFDEF ANDROID}
  1576. {$UNDEF HAS_getifaddrs}
  1577. {$ENDIF}
  1578. {$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
  1579. {$DEFINE REQUIRES_PROPER_ALIGNMENT}
  1580. {$ENDIF}
  1581. //
  1582. //iconv defines section.
  1583. {$DEFINE USE_ICONV_UNIT}
  1584. {$DEFINE USE_ICONV_ENC}
  1585. {$IFDEF UNIX}
  1586. {$DEFINE USE_ICONV}
  1587. {$IFDEF USE_BASEUNIX}
  1588. {$IFDEF FPC}
  1589. {$UNDEF USE_ICONV_UNIT}
  1590. {$ELSE}
  1591. {$UNDEF USE_ICONV_ENC}
  1592. {$ENDIF}
  1593. {$ENDIF}
  1594. {$IFDEF KYLIXCOMPAT}
  1595. //important!! Iconv functions are defined in the libc.pas Kylix compatible unit.
  1596. {$UNDEF USE_ICONV_ENC}
  1597. {$UNDEF USE_ICONV_UNIT}
  1598. {$ENDIF}
  1599. {$ENDIF}
  1600. {$IFDEF NETWARELIBC}
  1601. {$DEFINE USE_ICONV}
  1602. //important!!! iconv functions are defined in the libc.pas Novell Netware header.
  1603. //Do not define USE_ICONV_UNIT
  1604. {$UNDEF USE_ICONV_UNIT}
  1605. {$UNDEF USE_ICONV_ENC}
  1606. {$ENDIF}
  1607. {$UNDEF USE_SAFELOADLIBRARY}
  1608. {$IFDEF WINDOWS}
  1609. {$UNDEF USE_ICONV_ENC}
  1610. {$DEFINE USE_SAFELOADLIBRARY}
  1611. {$ENDIF}
  1612. // Use here for all *nix systems that you do not want to use iconv library
  1613. {$IFDEF FPC}
  1614. {$IFDEF ANDROID}
  1615. {$UNDEF USE_ICONV}
  1616. {$DEFINE USE_LCONVENC}
  1617. {$ENDIF}
  1618. {$ENDIF}
  1619. {$UNDEF USE_INVALIDATE_MOD_CACHE}
  1620. {$UNDEF USE_SAFELOADLIBRARY}
  1621. //This must come after the iconv defines because this compiler targets a Unix-like
  1622. //operating system. One key difference is that it does have a TEncoding class.
  1623. //If this comes before the ICONV defines, it creates problems.
  1624. //This also must go before the THandle size calculations.
  1625. {$IFDEF VCL_CROSS_COMPILE}
  1626. {$IFDEF POSIX}
  1627. {$IFNDEF LINUX}
  1628. {$DEFINE BSD}
  1629. {$ENDIF}
  1630. {$DEFINE USE_SAFELOADLIBRARY}
  1631. {$DEFINE USE_INVALIDATE_MOD_CACHE}
  1632. {$ENDIF}
  1633. //important!!! iconv functions are defined in the libc.pas Novell Netware header.
  1634. //Do not define USE_ICONVUNIT
  1635. {$UNDEF USE_ICONV}
  1636. {$UNDEF USE_ICONV_UNIT}
  1637. {$UNDEF USE_ICONV_ENC}
  1638. {$DEFINE INT_THREAD_PRIORITY}
  1639. {$ENDIF}
  1640. {$IFNDEF USE_ICONV}
  1641. {$UNDEF USE_ICONV_UNIT}
  1642. {$UNDEF USE_ICONV_ENC}
  1643. {$ENDIF}
  1644. //IMPORTANT!!!!
  1645. //
  1646. //Do not remove this!!! This is to work around a conflict. In DCC, MACOS
  1647. //will mean OS X. In FreePascal, the DEFINE MACOS means MacIntosh System OS Classic.
  1648. {$IFDEF DCC}
  1649. // DCC defines MACOS for both iOS and OS X platforms, need to differentiate
  1650. {$IFDEF MACOS}
  1651. {$IFNDEF IOS}
  1652. {$DEFINE OSX}
  1653. {$DEFINE DARWIN}
  1654. {$ENDIF}
  1655. {$ENDIF}
  1656. {$ENDIF}
  1657. {$IFDEF FPC}
  1658. // FPC defines DARWIN for both OSX and iOS, need to differentiate
  1659. {$IFDEF DARWIN}
  1660. {$IFNDEF IOS}
  1661. {$DEFINE OSX}
  1662. {$ENDIF}
  1663. {$ENDIF}
  1664. {$IFDEF MACOS}
  1665. {$DEFINE MACOS_CLASSIC}
  1666. {$ENDIF}
  1667. {$ENDIF}
  1668. {
  1669. BSD 4.4 introduced a minor API change. sa_family was changed from a 16bit
  1670. word to an 8 bit byte and an 8 bit byte field named sa_len was added.
  1671. }
  1672. //Place this only after DARWIN has been defined for Delphi MACOS
  1673. {$IFDEF FREEBSD}
  1674. {$DEFINE SOCK_HAS_SINLEN}
  1675. {$ENDIF}
  1676. {$IFDEF DARWIN}
  1677. {$DEFINE SOCK_HAS_SINLEN}
  1678. {$ENDIF}
  1679. {$IFDEF HAIKU}
  1680. {$DEFINE SOCK_HAS_SINLEN}
  1681. {$ENDIF}
  1682. {$IFDEF MORPHOS}
  1683. {$DEFINE SOCK_HAS_SINLEN}
  1684. {$ENDIF}
  1685. // Do NOT remove these IFDEF's. They are here because InterlockedExchange
  1686. // only handles 32bit values. Some Operating Systems may have 64bit
  1687. // THandles. This is not always tied to the platform architecture.
  1688. {$IFDEF AMIGA}
  1689. {$DEFINE THANDLE_CPUBITS}
  1690. {$ENDIF}
  1691. {$IFDEF ATARI}
  1692. {$DEFINE THANDLE_32}
  1693. {$ENDIF}
  1694. {$IFDEF BEOS}
  1695. {$DEFINE THANDLE_32}
  1696. {$ENDIF}
  1697. {$IFDEF BSD}
  1698. //I think BSD might handle FreeBSD, NetBSD, OpenBSD, and Darwin
  1699. {$IFDEF IOS}
  1700. {$IFDEF CPUARM64}
  1701. {$DEFINE CPU64}
  1702. {$DEFINE THANDLE_64}
  1703. {$ELSE}
  1704. {$IFDEF CPUARM32}
  1705. {$DEFINE CPU32}
  1706. {$ENDIF}
  1707. {$DEFINE THANDLE_32}
  1708. {$ENDIF}
  1709. {$ENDIF}
  1710. {$IFDEF OSX}
  1711. {$IFDEF FPC}
  1712. {$DEFINE THANDLE_32}
  1713. {$ELSE}
  1714. {$DEFINE THANDLE_CPUBITS} // !!! ADDED OSX BY EMBT
  1715. {$ENDIF}
  1716. {$ENDIF}
  1717. {$ENDIF}
  1718. {$IFDEF EMBEDDED}
  1719. {$DEFINE THANDLE_CPUBITS}
  1720. {$ENDIF}
  1721. {$IFDEF EMX}
  1722. {$DEFINE THANDLE_32}
  1723. {$ENDIF}
  1724. {$IFDEF GBA}
  1725. {$DEFINE THANDLE_32}
  1726. {$ENDIF}
  1727. {$IFDEF GO32}
  1728. {$DEFINE THANDLE_32}
  1729. {$ENDIF}
  1730. {$IFDEF HAIKU}
  1731. {$DEFINE THANDLE_32}
  1732. {$ENDIF}
  1733. {$IFDEF LINUX}
  1734. {$IFDEF LINUX64}
  1735. {$DEFINE CPU64}
  1736. {$DEFINE THANDLE_64}
  1737. {$ELSE}
  1738. {$IFDEF LINUX32}
  1739. {$DEFINE CPU32}
  1740. {$ENDIF}
  1741. {$DEFINE THANDLE_32}
  1742. {$ENDIF}
  1743. {$ENDIF}
  1744. {$IFDEF MACOS_CLASSIC}
  1745. {$DEFINE THANDLE_CPUBITS}
  1746. {$ENDIF}
  1747. {$IFDEF MORPHOS}
  1748. {$DEFINE THANDLE_CPUBITS}
  1749. {$ENDIF}
  1750. {$IFDEF NATIVENT} //Native NT for kernel level drivers
  1751. {$DEFINE THANDLE_CPUBITS}
  1752. {$ENDIF}
  1753. {$IFDEF NDS}
  1754. {$DEFINE THANDLE_32}
  1755. {$ENDIF}
  1756. {$IFDEF NETWARE}
  1757. {$DEFINE THANDLE_32}
  1758. {$ENDIF}
  1759. {$IFDEF NETWARELIBC}
  1760. {$DEFINE THANDLE_32}
  1761. {$ENDIF}
  1762. {$IFDEF OS2}
  1763. {$DEFINE THANDLE_32}
  1764. {$ENDIF}
  1765. {$IFDEF PALMOS}
  1766. {$DEFINE THANDLE_32}
  1767. {$ENDIF}
  1768. {$IFDEF SOLARIS}
  1769. {$DEFINE THANDLE_32}
  1770. {$ENDIF}
  1771. {$IFDEF SYMBIAN}
  1772. {$DEFINE THANDLE_32}
  1773. {$ENDIF}
  1774. {$IFDEF WII}
  1775. {$DEFINE THANDLE_32}
  1776. {$ENDIF}
  1777. {$IFDEF WATCOM}
  1778. {$DEFINE THANDLE_32}
  1779. {$ENDIF}
  1780. {$IFDEF WINDOWS}
  1781. {$DEFINE THANDLE_CPUBITS}
  1782. {$ENDIF}
  1783. // end platform specific stuff for THandle size
  1784. {$IFDEF THANDLE_CPUBITS}
  1785. {$IFDEF CPU64}
  1786. {$DEFINE THANDLE_64}
  1787. {$ELSE}
  1788. {$DEFINE THANDLE_32}
  1789. {$ENDIF}
  1790. {$ENDIF}
  1791. {$IFDEF DOTNET}
  1792. {$DEFINE DOTNET_OR_ICONV}
  1793. {$ENDIF}
  1794. {$IFDEF USE_ICONV}
  1795. {$DEFINE DOTNET_OR_ICONV}
  1796. {$ENDIF}
  1797. {$UNDEF STREAM_SIZE_64}
  1798. {$IFDEF FPC}
  1799. {$DEFINE STREAM_SIZE_64}
  1800. {$ELSE}
  1801. {$IFDEF VCL_6_OR_ABOVE}
  1802. {$DEFINE STREAM_SIZE_64}
  1803. {$ENDIF}
  1804. {$ENDIF}
  1805. {$IFNDEF FREE_ON_FINAL}
  1806. {$IFNDEF DOTNET}
  1807. {$IFDEF HAS_System_RegisterExpectedMemoryLeak}
  1808. {$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
  1809. {$ENDIF}
  1810. {$IFDEF USE_FASTMM4}
  1811. {$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
  1812. {$ENDIF}
  1813. {$IFDEF USE_MADEXCEPT}
  1814. {$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
  1815. {$ENDIF}
  1816. {$IFDEF USE_LEAKCHECK}
  1817. {$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
  1818. {$ENDIF}
  1819. {$ENDIF}
  1820. {$ENDIF}
  1821. {
  1822. We must determine what the SocketType parameter is for the Socket function.
  1823. In DotNET, it's SocketType. In Kylix and the libc.pas Kylix-compatibility
  1824. library, it's a __socket_type. In BaseUnix, it's a C-type Integer. In Windows,
  1825. it's a LongInt.
  1826. }
  1827. {$UNDEF SOCKETTYPE_IS_SOCKETTYPE}
  1828. {$UNDEF SOCKETTYPE_IS_CINT}
  1829. {$UNDEF SOCKETTYPE_IS___SOCKETTYPE}
  1830. {$UNDEF SOCKETTYPE_IS_LONGINT}
  1831. {$UNDEF SOCKETTYPE_IS_NUMERIC}
  1832. {$UNDEF SOCKET_LEN_IS_socklen_t}
  1833. {$IFDEF DOTNET}
  1834. {$DEFINE SOCKETTYPE_IS_SOCKETTYPE}
  1835. {$ENDIF}
  1836. {$IFDEF USE_BASEUNIX}
  1837. {$DEFINE SOCKETTYPE_IS_CINT}
  1838. {$DEFINE SOCKETTYPE_IS_NUMERIC}
  1839. {$ENDIF}
  1840. {$IFDEF KYLIXCOMPAT}
  1841. {$DEFINE SOCKETTYPE_IS___SOCKETTYPE}
  1842. {$ENDIF}
  1843. {$IFDEF USE_VCL_POSIX}
  1844. {$DEFINE SOCKETTYPE_IS_NUMERIC}
  1845. {$DEFINE SOCKETTYPE_IS_LONGINT}
  1846. {$DEFINE SOCKET_LEN_IS_socklen_t}
  1847. {$ENDIF}
  1848. {$IFDEF WINDOWS}
  1849. {$DEFINE SOCKETTYPE_IS_LONGINT}
  1850. {$DEFINE SOCKETTYPE_IS_NUMERIC}
  1851. {$ENDIF}
  1852. {$IFDEF OS2}
  1853. {$DEFINE SOCKETTYPE_IS_LONGINT}
  1854. {$DEFINE SOCKETTYPE_IS_NUMERIC}
  1855. {$ENDIF}
  1856. {$IFDEF NETWARE}
  1857. {$DEFINE SOCKETTYPE_IS_LONGINT}
  1858. {$DEFINE SOCKETTYPE_IS_NUMERIC}
  1859. {$ENDIF}
  1860. {Take advantage of some TCP features specific to some stacks.
  1861. They work somewhat similarly but there's a key difference.
  1862. In Linux, TCP_CORK is turned on to send fixed packet sizes and
  1863. when turned-off (uncorked), any remaining data is sent. With
  1864. TCP_NOPUSH, this might not happen and remaining data is only sent
  1865. before disconnect. TCP_KEEPIDLE and TCP_KEEPINTVL so the IFDEF LINUX and IFDEF
  1866. SOLARIS instead of IFDEF UNIX is not an error, it's deliberate.}
  1867. {$UNDEF HAS_TCP_NOPUSH}
  1868. {$UNDEF HAS_TCP_CORK}
  1869. {$UNDEF HAS_TCP_KEEPIDLE}
  1870. {$UNDEF HAS_TCP_KEEPINTVL}
  1871. {$UNDEF HAS_SOCKET_NOSIGPIPE}
  1872. {$IFDEF BSD}
  1873. {$DEFINE HAS_TCP_NOPUSH}
  1874. {$ENDIF}
  1875. {$IFDEF HAIKU}
  1876. {$DEFINE HAS_TCP_NOPUSH}
  1877. {$ENDIF}
  1878. {$IFDEF LINUX}
  1879. {$DEFINE HAS_TCP_CORK}
  1880. {$DEFINE HAS_TCP_KEEPIDLE}
  1881. {$DEFINE HAS_TCP_KEEPINTVL}
  1882. {$ENDIF}
  1883. {$IFDEF SOLARIS}
  1884. {$DEFINE HAS_TCP_CORK}
  1885. {$ENDIF}
  1886. {$IFDEF NETBSD}
  1887. {$DEFINE HAS_TCP_CORK}
  1888. {$DEFINE HAS_TCP_KEEPIDLE}
  1889. {$DEFINE HAS_TCP_KEEPINTVL}
  1890. {$ENDIF}
  1891. {$IFDEF USE_VCL_POSIX}
  1892. // TODO: which platforms actually have SO_NOSIGPIPE available?
  1893. {$DEFINE HAS_SOCKET_NOSIGPIPE}
  1894. {$IFDEF ANDROID}
  1895. {$UNDEF HAS_SOCKET_NOSIGPIPE}
  1896. {$ENDIF}
  1897. {$IFDEF LINUX}
  1898. {$UNDEF HAS_SOCKET_NOSIGPIPE}
  1899. {$ENDIF}
  1900. {$ENDIF}
  1901. {end Unix OS specific stuff}
  1902. {$IFDEF DEBUG}
  1903. {$UNDEF USE_INLINE}
  1904. {$ENDIF}
  1905. // RLebeau 5/24/2015: In C++Builder 2006 and 2007, UInt64 is emitted as
  1906. // signed __int64 in HPP files instead of as unsigned __int64. This causes
  1907. // conflicts in overloaded routines that have (U)Int64 parameters. This
  1908. // was fixed in C++Builder 2009. For compilers that do not have a native
  1909. // UInt64 type, or for C++Builder 2006/2007, let's define a record type
  1910. // that can hold UInt64 values...
  1911. {$IFDEF HAS_UInt64}
  1912. {$IFDEF BROKEN_UINT64_HPPEMIT}
  1913. {$DEFINE TIdUInt64_HAS_QuadPart}
  1914. {$ENDIF}
  1915. {$ELSE}
  1916. {$IFNDEF HAS_QWord}
  1917. {$DEFINE TIdUInt64_HAS_QuadPart}
  1918. {$ENDIF}
  1919. {$ENDIF}
  1920. // RLebeau 9/5/2013: it would take a lot of work to re-write Indy to support
  1921. // both 0-based and 1-based string indexing, so we'll just turn off 0-based
  1922. // indexing for now...
  1923. {$IFDEF HAS_DIRECTIVE_ZEROBASEDSTRINGS}
  1924. {$ZEROBASEDSTRINGS OFF}
  1925. {$ENDIF}