2
0

IdCompilerDefines.inc 57 KB

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