IdCompilerDefines.inc 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133
  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_7_0} //so developers can IFDEF for this product version
  16. {$DEFINE 10_7_0_0} //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. // Note: there is a ZLib unit available, but it doesn't have everything
  1060. // that is available in the System.ZLib unit in Delphi XE2+, so we are
  1061. // not going to use this ZLib unit yet...
  1062. {.$DEFINE HAS_UNIT_ZLib}
  1063. {$ENDIF}
  1064. {$DEFINE HAS_TFormatSettings}
  1065. {$DEFINE HAS_PosEx}
  1066. {$IFNDEF VCL_70}
  1067. // not implemented in D7
  1068. {$DEFINE HAS_STATIC_TThread_Queue}
  1069. {$ENDIF}
  1070. {$IFNDEF CIL}
  1071. {$IFNDEF VCL_80}
  1072. // not implemented in D8 or .NET
  1073. {$DEFINE HAS_STATIC_TThread_Synchronize}
  1074. {$ENDIF}
  1075. {$ENDIF}
  1076. {$ELSE}
  1077. {$IFDEF CBUILDER_6}
  1078. {$DEFINE HAS_NAMED_THREADS}
  1079. {$ENDIF}
  1080. {$ENDIF}
  1081. {$IFDEF VCL_2005_OR_ABOVE}
  1082. {$IFDEF DCC}
  1083. // class helpers were first introduced in D2005, but were buggy and not
  1084. // officially supported until D2006...
  1085. {.$DEFINE HAS_CLASS_HELPER}
  1086. {$ENDIF}
  1087. {$ELSE}
  1088. {$IFDEF DCC}
  1089. // InterlockedCompareExchange() was declared in the Windows unit using Pointer
  1090. // parameters until Delphi 2005, when it was switched to Longint parameters
  1091. // instead to match the actual Win32 API declaration.
  1092. {$DEFINE HAS_InterlockedCompareExchange_Pointers}
  1093. {$ENDIF}
  1094. {$ENDIF}
  1095. {$IFDEF VCL_2006_OR_ABOVE}
  1096. {$DEFINE USE_INLINE}
  1097. {$DEFINE HAS_2PARAM_FileAge}
  1098. {$DEFINE HAS_TStrings_LineBreak} // TODO: when was LineBreak introduced?
  1099. {$DEFINE HAS_CLASS_HELPER}
  1100. {$IFDEF WINDOWS}
  1101. // System.RegisterExpectedMemoryLeak() is only available on Windows at this time
  1102. {$DEFINE HAS_System_RegisterExpectedMemoryLeak}
  1103. {$ENDIF}
  1104. // In C++Builder 2006 and 2007, UInt64 is emitted as signed __int64 in HPP
  1105. // files instead of as unsigned __int64. This causes conflicts in overloaded
  1106. // routines that have (U)Int64 parameters. This was fixed in C++Builder 2009...
  1107. {$IFDEF CBUILDER}
  1108. {$DEFINE BROKEN_UINT64_HPPEMIT}
  1109. {$ENDIF}
  1110. {$ENDIF}
  1111. {$IFDEF VCL_2007_OR_ABOVE}
  1112. {$IFNDEF CBUILDER_2007}
  1113. // class properties are broken in C++Builder 2007, causing AVs at compile-time
  1114. {$DEFINE HAS_CLASS_PROPERTIES}
  1115. {$ENDIF}
  1116. // Native(U)Int exist but are buggy, so do not use them yet
  1117. {.$DEFINE HAS_NativeInt}
  1118. {.$DEFINE HAS_NativeUInt}
  1119. {$DEFINE HAS_DWORD_PTR}
  1120. {$DEFINE HAS_ULONG_PTR}
  1121. {$DEFINE HAS_ULONGLONG}
  1122. {$DEFINE HAS_PGUID}
  1123. {$DEFINE HAS_PPAnsiChar}
  1124. {$DEFINE HAS_CurrentYear}
  1125. {$IFNDEF DOTNET}
  1126. {$DEFINE HAS_TIMEUNITS}
  1127. {$ENDIF}
  1128. {$ENDIF}
  1129. {$IFDEF VCL_2009_OR_ABOVE}
  1130. {$IFNDEF DOTNET}
  1131. {$DEFINE STRING_IS_UNICODE}
  1132. {$DEFINE HAS_UnicodeString}
  1133. {$DEFINE HAS_TEncoding}
  1134. {$DEFINE HAS_TCharacter}
  1135. {$DEFINE HAS_InterlockedCompareExchangePointer}
  1136. {$DEFINE HAS_WIDE_TCharArray}
  1137. {$DEFINE HAS_PUInt64}
  1138. {$IFDEF VCL_2009}
  1139. // TODO: need to differentiate between RTM and Update 1
  1140. // FmtStr() is broken in RTM but was fixed in Update 1
  1141. {$DEFINE BROKEN_FmtStr}
  1142. {$ENDIF}
  1143. {$ENDIF}
  1144. {$DEFINE HAS_CLASS_VARS}
  1145. {$DEFINE HAS_DEPRECATED_MSG}
  1146. {$DEFINE HAS_TBytes}
  1147. // Native(U)Int are still buggy, so do not use them yet
  1148. {.$DEFINE HAS_NativeInt}
  1149. {.$DEFINE HAS_NativeUInt}
  1150. {$DEFINE HAS_Int8}
  1151. {$DEFINE HAS_UInt8}
  1152. {$DEFINE HAS_Int16}
  1153. {$DEFINE HAS_UInt16}
  1154. {$DEFINE HAS_Int32}
  1155. {$DEFINE HAS_UInt32}
  1156. {$DEFINE HAS_UIntToStr}
  1157. // UInt64 is now emitted as unsigned __int64 in HPP files
  1158. {$IFDEF CBUILDER}
  1159. {$UNDEF BROKEN_UINT64_HPPEMIT}
  1160. {$ENDIF}
  1161. {$IFDEF DCC}
  1162. {$IFDEF WINDOWS}
  1163. // Exception.RaiseOuterException() is only available on Windows at this time
  1164. {$DEFINE HAS_Exception_RaiseOuterException}
  1165. {$ENDIF}
  1166. {$ENDIF}
  1167. {$DEFINE HAS_SetCodePage}
  1168. {$DEFINE HAS_PRawByteString}
  1169. {$DEFINE HAS_TThreadProcedure}
  1170. {$ENDIF}
  1171. {$IFDEF VCL_2010_OR_ABOVE}
  1172. {$DEFINE HAS_CLASS_CONSTRUCTOR}
  1173. {$DEFINE HAS_CLASS_DESTRUCTOR}
  1174. {$DEFINE HAS_DELAYLOAD}
  1175. {$DEFINE HAS_TThread_NameThreadForDebugging}
  1176. {$DEFINE DEPRECATED_TThread_SuspendResume}
  1177. // Native(U)Int are finally ok to use now
  1178. {$DEFINE HAS_NativeInt}
  1179. {$DEFINE HAS_NativeUInt}
  1180. {$DEFINE HAS_USHORT}
  1181. {$DEFINE HAS_IOUtils_TPath}
  1182. {$ENDIF}
  1183. {$IFDEF VCL_XE_OR_ABOVE}
  1184. {$DEFINE HAS_TFormatSettings_Object}
  1185. {$DEFINE HAS_LocaleCharsFromUnicode}
  1186. {$DEFINE HAS_UnicodeFromLocaleChars}
  1187. {$DEFINE HAS_PLongBool}
  1188. {$DEFINE HAS_PVOID}
  1189. {$DEFINE HAS_ULONG64}
  1190. {$DEFINE HAS_TEncoding_GetEncoding_ByEncodingName}
  1191. {$DEFINE HAS_DateUtils_TTimeZone}
  1192. {$IFDEF DCC}
  1193. // Exception.RaiseOuterException() is now available on all platforms
  1194. {$DEFINE HAS_Exception_RaiseOuterException}
  1195. {$ENDIF}
  1196. {$IFNDEF DOTNET}
  1197. {$DEFINE HAS_TInterlocked}
  1198. {$ENDIF}
  1199. {$ENDIF}
  1200. {$IFDEF VCL_XE2_OR_ABOVE}
  1201. {$DEFINE HAS_SIZE_T}
  1202. {$DEFINE HAS_PSIZE_T}
  1203. {$DEFINE HAS_SSIZE_T}
  1204. {$DEFINE HAS_PSSIZE_T}
  1205. {$DEFINE HAS_LONG}
  1206. {$DEFINE HAS_ComponentPlatformsAttribute}
  1207. {$DEFINE HAS_ComponentPlatformsAttribute_Win32}
  1208. {$DEFINE HAS_ComponentPlatformsAttribute_Win64}
  1209. {$DEFINE HAS_ComponentPlatformsAttribute_OSX32}
  1210. {$DEFINE HAS_System_ReturnAddress}
  1211. {$DEFINE HAS_DIRECTIVE_WARN_DEFAULT}
  1212. {$DEFINE HAS_UNIT_System_ZLib}
  1213. {$ENDIF}
  1214. {$IFDEF VCL_XE3_OR_ABOVE}
  1215. {$DEFINE HAS_DIRECTIVE_ZEROBASEDSTRINGS}
  1216. {$DEFINE HAS_SysUtils_TStringHelper}
  1217. {$IFDEF NEXTGEN}
  1218. {$DEFINE DCC_NEXTGEN}
  1219. {$DEFINE HAS_MarshaledAString}
  1220. {$DEFINE USE_MARSHALLED_PTRS}
  1221. {$IFDEF AUTOREFCOUNT}
  1222. {$DEFINE USE_OBJECT_ARC}
  1223. {$ENDIF}
  1224. {$ENDIF}
  1225. // technically, these are present in XE3, but they are not used yet
  1226. {.$DEFINE HAS_ComponentPlatformsAttribute_iOS_Simulator}
  1227. {.$DEFINE HAS_ComponentPlatformsAttribute_Android}
  1228. {.$DEFINE HAS_ComponentPlatformsAttribute_Linux32}
  1229. {.$DEFINE HAS_ComponentPlatformsAttribute_iOS_Device}
  1230. {.$DEFINE HAS_ComponentPlatformsAttribute_WinNX32}
  1231. {$ENDIF}
  1232. {$IFDEF VCL_XE4_OR_ABOVE}
  1233. {$DEFINE HAS_AnsiStrings_StrPLCopy}
  1234. {$DEFINE HAS_AnsiStrings_StrLen}
  1235. {$DEFINE HAS_Character_TCharHelper}
  1236. {$DEFINE HAS_ComponentPlatformsAttribute_iOS_Simulator}
  1237. {$DEFINE HAS_ComponentPlatformsAttribute_iOS_Device}
  1238. {$ENDIF}
  1239. {$IFDEF VCL_XE5_OR_ABOVE}
  1240. {$DEFINE HAS_ComponentPlatformsAttribute_Android}
  1241. {$ENDIF}
  1242. {$IFDEF VCL_XE5_UPDATE2_OR_ABOVE}
  1243. {$DEFINE HAS_DIRECTIVE_HPPEMIT_LINKUNIT}
  1244. {$DEFINE HAS_DIRECTIVE_HPPEMIT_NAMESPACE}
  1245. {$ENDIF}
  1246. {$IFDEF VCL_XE7_OR_ABOVE}
  1247. {$DEFINE HAS_TNetEncoding}
  1248. {$ENDIF}
  1249. {$IFDEF VCL_XE8_OR_ABOVE}
  1250. {$DEFINE HAS_ComponentPlatformsAttribute_iOS_Device32}
  1251. {$DEFINE HAS_ComponentPlatformsAttribute_iOS_Device64}
  1252. // technically, these are present in XE8, but they are not used yet
  1253. {.$DEFINE HAS_ComponentPlatformsAttribute_Linux64}
  1254. {.$DEFINE HAS_ComponentPlatformsAttribute_WinIoT32}
  1255. {$ENDIF}
  1256. {$IFDEF VCL_10_0_OR_ABOVE}
  1257. {$IFDEF ANDROID}
  1258. {$DEFINE HAS_TAndroidHelper}
  1259. {$ENDIF}
  1260. // technically, these are present in 10.0 Seattle, but they are not used yet
  1261. {.$DEFINE HAS_ComponentPlatformsAttribute_WinARM}
  1262. {$ENDIF}
  1263. {$IFDEF VCL_10_1_OR_ABOVE}
  1264. {$DEFINE HAS_DIRECTIVE_HPPEMIT_LEGACYHPP}
  1265. {$DEFINE HAS_TStrings_AddPair}
  1266. // technically, these are present in 10.1 Berlin, but they are not used yet
  1267. {.$DEFINE HAS_ComponentPlatformsAttribute_OSX64}
  1268. {.$DEFINE HAS_ComponentPlatformsAttribute_OSXNX64}
  1269. {.$DEFINE HAS_ComponentPlatformsAttribute_Linux32Arm}
  1270. {.$DEFINE HAS_ComponentPlatformsAttribute_Linux64Arm}
  1271. {.$DEFINE HAS_ComponentPlatformsAttribute_Android64}
  1272. {$ENDIF}
  1273. {$IFDEF VCL_10_2_OR_ABOVE}
  1274. {.$WARN IMPLICIT_INTEGER_CAST_LOSS OFF}
  1275. {.$WARN IMPLICIT_CONVERSION_LOSS OFF}
  1276. {.$WARN COMBINING_SIGNED_UNSIGNED64 OFF}
  1277. {$DEFINE HAS_STATIC_TThread_ForceQueue}
  1278. // In Delphi 10.2 Tokyo, TThread.ForceQueue() is broken on Android, the
  1279. // passed in procedure is called immediately instead of being delayed!
  1280. {$IFDEF ANDROID}
  1281. {$DEFINE BROKEN_TThread_ForceQueue}
  1282. {$ENDIF}
  1283. {$ENDIF}
  1284. {$IFDEF VCL_10_3_OR_ABOVE}
  1285. {$DEFINE HAS_ComponentPlatformsAttribute_iOS_Simulator32}
  1286. {$DEFINE HAS_ComponentPlatformsAttribute_Android32Arm}
  1287. {$DEFINE HAS_ComponentPlatformsAttribute_WinARM32}
  1288. {$UNDEF HAS_ComponentPlatformsAttribute_OSXNX64} // removed in 10.3 Rio
  1289. // technically, these are present in 10.3 Rio, but they are not used yet
  1290. {.$DEFINE HAS_ComponentPlatformsAttribute_iOS_Simulator64}
  1291. {$IFDEF DCC}
  1292. {$IFDEF LINUX}
  1293. // RLebeau 9/25/2019: there is a bug in the IDE when debugging Linux projects
  1294. // where the EThreadNameException exception raised by TThread.NameThreadForDebugging()
  1295. // is not handled correctly.
  1296. {$UNDEF HAS_NAMED_THREADS}
  1297. {$ENDIF}
  1298. {$ENDIF}
  1299. {$IFDEF ANDROID}
  1300. {$UNDEF BROKEN_TThread_ForceQueue}
  1301. {$ENDIF}
  1302. {$ENDIF}
  1303. {$IFDEF VCL_10_3_UPDATE2_OR_ABOVE}
  1304. {$DEFINE HAS_ComponentPlatformsAttribute_AllPlatforms}
  1305. {$DEFINE HAS_ComponentPlatformsAttribute_OSX64}
  1306. {$ENDIF}
  1307. {$IFDEF VCL_10_4_OR_ABOVE}
  1308. // 0-based string indexing via '[]' is turned off by default in Delphi 10.4.
  1309. // TStringHelper is always 0-indexed, flat RTL functions are always 1-indexed,
  1310. // and now '[]' is 1-indexed again on all platforms - {$ZEROBASEDSTRINGS OFF}
  1311. // is the default.
  1312. {.$UNDEF HAS_DIRECTIVE_ZEROBASEDSTRINGS}
  1313. {$ENDIF}
  1314. {$IFDEF VCL_11_OR_ABOVE}
  1315. {$DEFINE HAS_ComponentPlatformsAttribute_AndroidArm32}
  1316. {$DEFINE HAS_ComponentPlatformsAttribute_AndroidArm64}
  1317. {$DEFINE HAS_ComponentPlatformsAttribute_OSXArm64}
  1318. {$ENDIF}
  1319. {$IFDEF VCL_13_OR_ABOVE}
  1320. {$DEFINE CAN_PUSHPOP_OPTIONS}
  1321. {$DEFINE USE_NORETURN}
  1322. // it is sufficient to have 'noturn' just on an implementation
  1323. // and not on the declaration, the compiler won't care either way...
  1324. {.$DEFINE USE_NORETURN_DECL}
  1325. {$DEFINE USE_NORETURN_IMPL}
  1326. {$ENDIF}
  1327. // Delphi XE+ cross-compiling
  1328. {$IFNDEF FPC}
  1329. {$IFDEF POSIX}
  1330. {$IF RTLVersion >= 22.0}
  1331. {$DEFINE UNIX}
  1332. {$UNDEF USE_BASEUNIX}
  1333. {$DEFINE VCL_CROSS_COMPILE}
  1334. {$DEFINE USE_VCL_POSIX}
  1335. {$IFEND}
  1336. {$ENDIF}
  1337. {$IFDEF LINUX}
  1338. {$IFDEF CONDITIONALEXPRESSIONS}
  1339. {$IF RTLVersion >= 22.0}
  1340. {$DEFINE VCL_CROSS_COMPILE}
  1341. {$DEFINE USE_VCL_POSIX}
  1342. {$IFEND}
  1343. {$ENDIF}
  1344. {$ENDIF}
  1345. {$ENDIF}
  1346. {$IFDEF VCL_CROSS_COMPILE}
  1347. {$UNDEF KYLIXCOMPAT}
  1348. {$ELSE}
  1349. {$IFDEF KYLIXCOMPAT}
  1350. {$linklib c}
  1351. {$ENDIF}
  1352. {$ENDIF}
  1353. {$IFDEF FPC}
  1354. {$DEFINE USE_INLINE}
  1355. {$DEFINE USE_CLASS_INLINE}
  1356. {$DEFINE USE_TBitBtn} //use Bit Buttons instead of Buttons
  1357. {$DEFINE FPC_REINTRODUCE_BUG}
  1358. {$DEFINE FPC_CIRCULAR_BUG}
  1359. {$DEFINE NO_REDECLARE}
  1360. {$DEFINE BYTE_COMPARE_SETS}
  1361. {$DEFINE HAS_QWord} // TODO: when was QWord introduced?
  1362. {$DEFINE HAS_PQWord} // TODO: when was PQWord introduced?
  1363. {$IFDEF FPC_2_1_5_OR_ABOVE}
  1364. {$DEFINE HAS_UInt64}
  1365. {.$DEFINE HAS_PUInt64} // TODO: is this defined?
  1366. {$ENDIF}
  1367. {$IFDEF FPC_2_2_0_OR_ABOVE}
  1368. {$DEFINE HAS_InterlockedCompareExchange_Pointers}
  1369. {$ENDIF}
  1370. {$IFDEF FPC_2_2_2_OR_ABOVE}
  1371. {$DEFINE HAS_SharedSuffix}
  1372. {$ENDIF}
  1373. {$IFDEF FPC_2_2_4_OR_ABOVE}
  1374. // these types are only available on Unix systems (FreeBSD, Linux, etc)
  1375. {$IFDEF UNIX}
  1376. {$DEFINE HAS_UNIT_UnixType}
  1377. {$DEFINE HAS_SIZE_T}
  1378. {$DEFINE HAS_PSIZE_T}
  1379. {$DEFINE HAS_SSIZE_T}
  1380. {$DEFINE HAS_PSSIZE_T}
  1381. {$DEFINE HAS_TIME_T}
  1382. {$DEFINE HAS_PTIME_T}
  1383. {$ENDIF}
  1384. {$ENDIF}
  1385. {$DEFINE HAS_PtrInt}
  1386. {$DEFINE HAS_PtrUInt}
  1387. {$DEFINE HAS_PGUID}
  1388. {$DEFINE HAS_LPGUID}
  1389. {$DEFINE HAS_PPAnsiChar}
  1390. {$DEFINE HAS_ENUM_ELEMENT_VALUES}
  1391. {$DEFINE HAS_AcquireExceptionObject} // TODO: when was AcquireExceptionObject introduced?
  1392. {$IFDEF WINDOWS}
  1393. {$DEFINE HAS_ULONG_PTR}
  1394. {.$DEFINE HAS_ULONGLONG} // TODO: is this defined?
  1395. {$ENDIF}
  1396. {$DEFINE HAS_UNIT_ctypes}
  1397. {$DEFINE HAS_sLineBreak}
  1398. {$DEFINE HAS_TStrings_LineBreak} // TODO: when was LineBreak introduced?
  1399. {$IFDEF FPC_HAS_UNICODESTRING}
  1400. {$DEFINE HAS_UnicodeString}
  1401. {$ELSE}
  1402. {$IFDEF FPC_2_4_0_OR_ABOVE}
  1403. {$DEFINE HAS_UnicodeString}
  1404. {$ENDIF}
  1405. {$ENDIF}
  1406. {$IFDEF FPC_2_4_4_OR_ABOVE}
  1407. {$DEFINE DEPRECATED_TThread_SuspendResume}
  1408. {$DEFINE HAS_DEPRECATED} // TODO: when was deprecated introduced? Possibly 1.9.x
  1409. {$DEFINE HAS_DEPRECATED_MSG} // TODO: when was message support added? Possibly 2.4.x
  1410. {$DEFINE HAS_STATIC_TThread_Synchronize}
  1411. {$IFNDEF FPC_2_6_2_OR_ABOVE}
  1412. {$DEFINE USE_SEMICOLON_BEFORE_DEPRECATED} // TODO: which earlier versions require a semicolon?
  1413. {$ENDIF}
  1414. {$ENDIF}
  1415. {$IFDEF FPC_2_6_0_OR_ABOVE}
  1416. {$DEFINE HAS_NativeInt}
  1417. {$DEFINE HAS_NativeUInt}
  1418. {$DEFINE HAS_CLASS_HELPER}
  1419. {.$DEFINE USE_NORETURN}
  1420. // FPC 3.3.1 has a regression where 'noreturn' on an implementation but not
  1421. // on the declaration will cause a compiler error. FPC 3.2.2 compiles fine...
  1422. {.$IFDEF FPC_3_3_1_OR_ABOVE}
  1423. //{$DEFINE USE_NORETURN_DECL}
  1424. //{.$DEFINE USE_NORETURN_IMPL}
  1425. {.$ELSE}
  1426. //{.$DEFINE USE_NORETURN_DECL}
  1427. //{$DEFINE USE_NORETURN_IMPL}
  1428. {.$ENDIF}
  1429. {$ENDIF}
  1430. {$IFDEF FPC_2_6_2_OR_ABOVE}
  1431. {$DEFINE HAS_Int8}
  1432. {$DEFINE HAS_UInt8}
  1433. {$DEFINE HAS_Int16}
  1434. {$DEFINE HAS_UInt16}
  1435. {$DEFINE HAS_Int32}
  1436. {$DEFINE HAS_UInt32}
  1437. {$DEFINE HAS_GetLocalTimeOffset}
  1438. {$DEFINE HAS_UniversalTimeToLocal}
  1439. {$DEFINE HAS_LocalTimeToUniversal}
  1440. {$ENDIF}
  1441. {$IFDEF FPC_2_6_4_OR_ABOVE}
  1442. {$DEFINE HAS_PInt8}
  1443. {$DEFINE HAS_PUInt8}
  1444. {$DEFINE HAS_PInt16}
  1445. {$DEFINE HAS_PUInt16}
  1446. {$DEFINE HAS_PInt32}
  1447. {$DEFINE HAS_PUInt32}
  1448. {$ENDIF}
  1449. {$IFDEF FPC_3_0_0_OR_ABOVE}
  1450. {$DEFINE HAS_STATIC_TThread_Queue}
  1451. {$DEFINE HAS_SetCodePage}
  1452. {$ENDIF}
  1453. {$IFDEF FPC_UNICODESTRINGS}
  1454. {$DEFINE STRING_IS_UNICODE}
  1455. {$ENDIF}
  1456. {$IFDEF FPC_3_1_1_OR_ABOVE}
  1457. {$DEFINE HAS_STATIC_TThread_ForceQueue} // requires rev 37359+
  1458. {$DEFINE HAS_PRawByteString}
  1459. {$DEFINE HAS_UIntToStr} // requires rev 40529+
  1460. {$ENDIF}
  1461. {$DEFINE CAN_PUSHPOP_OPTIONS} // TODO: when was push/pop introduced?
  1462. {$ENDIF}
  1463. {$IFDEF DOTNET}
  1464. {$DEFINE WIDGET_WINFORMS}
  1465. {$ELSE}
  1466. {$DEFINE WIDGET_VCL_LIKE} // LCL included.
  1467. {$DEFINE WIDGET_VCL_LIKE_OR_KYLIX}
  1468. {$IFDEF FPC}
  1469. {$DEFINE WIDGET_LCL}
  1470. {$ELSE}
  1471. {$IFDEF KYLIX}
  1472. {$DEFINE WIDGET_KYLIX}
  1473. {$ELSE}
  1474. {$DEFINE WIDGET_VCL}
  1475. {$ENDIF}
  1476. {$ENDIF}
  1477. {$ENDIF}
  1478. // .NET and Delphi 2009+ support UNICODE strings natively!
  1479. //
  1480. // FreePascal 2.4.0+ supports UnicodeString, but does not map its
  1481. // native String type to UnicodeString except when {$MODE DelphiUnicode}
  1482. // or {$MODESWITCH UnicodeStrings} is enabled. However, UNICODE is not
  1483. // defined in that mode yet until its RTL has been updated to support
  1484. // UnicodeString. STRING_UNICODE_MISMATCH is defined when the native
  1485. // String/Char types do not map to the same types that APIs are expecting
  1486. // based on whether UNICODE is defined or not.
  1487. //
  1488. // NOTE: Do not define UNICODE here. The compiler defines
  1489. // the symbol automatically.
  1490. {$IFDEF STRING_IS_UNICODE}
  1491. {$IFNDEF UNICODE}
  1492. {$DEFINE STRING_UNICODE_MISMATCH}
  1493. {$ENDIF}
  1494. {$ELSE}
  1495. {$DEFINE STRING_IS_ANSI}
  1496. {$IFDEF UNICODE}
  1497. {$DEFINE STRING_UNICODE_MISMATCH}
  1498. {$ENDIF}
  1499. {$ENDIF}
  1500. {$IFDEF DCC_NEXTGEN}
  1501. {$DEFINE NO_ANSI_TYPES}
  1502. {.$DEFINE STRING_IS_IMMUTABLE} // Strings are NOT immutable in NEXTGEN yet
  1503. {$IFDEF USE_OBJECT_ARC}
  1504. // TODO: move these to an appropriate section. Not doing this yet because
  1505. // it is a major interface change to switch to Generics and we should
  1506. // maintain backwards compatibility with earlier compilers for the time
  1507. // being. Defining them only here for now because the non-Generic versions
  1508. // of these classes have become deprecated by ARC and so we need to start
  1509. // taking advantage of the Generics versions...
  1510. {$DEFINE HAS_UNIT_Generics_Collections}
  1511. {$DEFINE HAS_UNIT_Generics_Defaults}
  1512. {$DEFINE HAS_GENERICS_TDictionary}
  1513. {$DEFINE HAS_GENERICS_TList}
  1514. {$DEFINE HAS_GENERICS_TObjectList}
  1515. {$DEFINE HAS_GENERICS_TThreadList}
  1516. // TArray<T>.Copy() was introduced in XE7 but was buggy. It was fixed in XE8:
  1517. //
  1518. // RSP-9763 TArray.Copy<T> copies from destination to source for unmanaged types
  1519. // https://quality.embarcadero.com/browse/RSP-9763
  1520. //
  1521. {$IFDEF VCL_XE8_OR_ABOVE}
  1522. {$DEFINE HAS_GENERICS_TArray_Copy}
  1523. {$ENDIF}
  1524. {$ENDIF}
  1525. {$ENDIF}
  1526. // TODO: Ansi data types were disabled on mobile platforms in XE3, but
  1527. // UTF8String and RawByteString were re-enabled in 10.1 Berlin! What else,
  1528. // if anything, was re-enabled to facilitate that?
  1529. //
  1530. // UPDATE: In 10.4 Sydney, AnsiChar and AnsiString were re-enabled on
  1531. // mobile platforms! NEXTGEN is no longer defined in the mobile compilers.
  1532. {$IFDEF NO_ANSI_TYPES}
  1533. {$UNDEF HAS_AnsiString}
  1534. {$UNDEF HAS_AnsiChar}
  1535. {$UNDEF HAS_PAnsiChar}
  1536. {$UNDEF HAS_PPAnsiChar}
  1537. {$UNDEF HAS_AnsiStrings_StrPLCopy}
  1538. {$UNDEF HAS_AnsiStrings_StrLen}
  1539. {$ENDIF}
  1540. {$IFDEF WIN32}
  1541. {$DEFINE WIN32_OR_WIN64}
  1542. {$ENDIF}
  1543. {$IFDEF WIN64}
  1544. {$DEFINE WIN32_OR_WIN64}
  1545. {$ENDIF}
  1546. {$IFDEF WIN32_OR_WIN64}
  1547. {$DEFINE USE_ZLIB_UNIT}
  1548. {$IFNDEF DCC_NEXTGEN}
  1549. {$DEFINE USE_OPENSSL} // !!! MOVED HERE BY EMBT
  1550. {$DEFINE USE_SSPI}
  1551. {$IFDEF STRING_IS_UNICODE}
  1552. {$DEFINE SSPI_UNICODE}
  1553. {$ENDIF}
  1554. {$ENDIF}
  1555. {$ENDIF}
  1556. {$IFDEF WINCE}
  1557. {$DEFINE USE_OPENSSL}
  1558. // RLebeau: not sure if the above Win32/64 defines also apply to WinCE,
  1559. // so keeping them separate for now...
  1560. {$ENDIF}
  1561. // High-performance counters are not reliable on multi-core systems, and have
  1562. // been known to cause problems with TIdIOHandler.ReadLn() timeouts in Windows
  1563. // XP SP3, both 32-bit and 64-bit. Refer to these discussions for more info:
  1564. //
  1565. // http://www.virtualdub.org/blog/pivot/entry.php?id=106
  1566. // http://blogs.msdn.com/oldnewthing/archive/2008/09/08/8931563.aspx
  1567. //
  1568. // Do not enable thus unless you know it will work correctly on your systems!
  1569. {$IFDEF WINDOWS}
  1570. {.$DEFINE USE_HI_PERF_COUNTER_FOR_TICKS}
  1571. {$ENDIF}
  1572. {$IFDEF UNIX}
  1573. {$DEFINE USE_OPENSSL}
  1574. {$DEFINE USE_ZLIB_UNIT}
  1575. {$DEFINE HAS_getifaddrs}
  1576. {$ENDIF}
  1577. {$IFDEF MACOS}
  1578. {$DEFINE HAS_getifaddrs}
  1579. {$ENDIF}
  1580. {$IFDEF DARWIN}
  1581. {$DEFINE HAS_getifaddrs}
  1582. {$ENDIF}
  1583. {$IFDEF LINUX}
  1584. {$DEFINE HAS_getifaddrs}
  1585. {$ENDIF}
  1586. {$IFDEF IOS}
  1587. {$DEFINE HAS_getifaddrs}
  1588. {$DEFINE USE_OPENSSL}
  1589. // Support for 64-bit ARM iOS Simulator was added in Delphi 11.2
  1590. // TODO: how to detect iOS Simulator in FPC? Does it support 64-bit ARM?
  1591. {$IFDEF CPUARM}
  1592. {$IFNDEF IOSSIMULATOR}
  1593. // RLebeau: For iOS devices, OpenSSL cannot be used as an external library,
  1594. // it must be statically linked into the app. For the iOS simulator, this
  1595. // is not true. Users who want to use OpenSSL in iOS device apps will need
  1596. // to add the static OpenSSL library to the project and then include the
  1597. // IdSSLOpenSSLHeaders_static unit in their uses clause. It hooks up the
  1598. // statically linked functions for the IdSSLOpenSSLHeaders unit to use...
  1599. {$DEFINE STATICLOAD_OPENSSL}
  1600. {$ENDIF}
  1601. {$ENDIF}
  1602. {$ENDIF}
  1603. {$IFDEF FREEBSD}
  1604. {$DEFINE HAS_getifaddrs}
  1605. {$ENDIF}
  1606. {$IFDEF ANDROID}
  1607. {$UNDEF HAS_getifaddrs}
  1608. {$ENDIF}
  1609. {$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
  1610. {$DEFINE REQUIRES_PROPER_ALIGNMENT}
  1611. {$ENDIF}
  1612. //
  1613. //iconv defines section.
  1614. {$DEFINE USE_ICONV_UNIT}
  1615. {$DEFINE USE_ICONV_ENC}
  1616. {$IFDEF UNIX}
  1617. {$DEFINE USE_ICONV}
  1618. {$IFDEF USE_BASEUNIX}
  1619. {$IFDEF FPC}
  1620. {$UNDEF USE_ICONV_UNIT}
  1621. {$ELSE}
  1622. {$UNDEF USE_ICONV_ENC}
  1623. {$ENDIF}
  1624. {$ENDIF}
  1625. {$IFDEF KYLIXCOMPAT}
  1626. //important!! Iconv functions are defined in the libc.pas Kylix compatible unit.
  1627. {$UNDEF USE_ICONV_ENC}
  1628. {$UNDEF USE_ICONV_UNIT}
  1629. {$ENDIF}
  1630. {$ENDIF}
  1631. {$IFDEF NETWARELIBC}
  1632. {$DEFINE USE_ICONV}
  1633. //important!!! iconv functions are defined in the libc.pas Novell Netware header.
  1634. //Do not define USE_ICONV_UNIT
  1635. {$UNDEF USE_ICONV_UNIT}
  1636. {$UNDEF USE_ICONV_ENC}
  1637. {$ENDIF}
  1638. {$UNDEF USE_SAFELOADLIBRARY}
  1639. {$IFDEF WINDOWS}
  1640. {$UNDEF USE_ICONV_ENC}
  1641. {$DEFINE USE_SAFELOADLIBRARY}
  1642. {$ENDIF}
  1643. // Use here for all *nix systems that you do not want to use iconv library
  1644. {$IFDEF FPC}
  1645. {$IFDEF ANDROID}
  1646. {$UNDEF USE_ICONV}
  1647. {$DEFINE USE_LCONVENC}
  1648. {$ENDIF}
  1649. {$ENDIF}
  1650. {$UNDEF USE_INVALIDATE_MOD_CACHE}
  1651. {$UNDEF USE_SAFELOADLIBRARY}
  1652. //This must come after the iconv defines because this compiler targets a Unix-like
  1653. //operating system. One key difference is that it does have a TEncoding class.
  1654. //If this comes before the ICONV defines, it creates problems.
  1655. //This also must go before the THandle size calculations.
  1656. {$IFDEF VCL_CROSS_COMPILE}
  1657. {$IFDEF POSIX}
  1658. {$IFNDEF LINUX}
  1659. {$DEFINE BSD}
  1660. {$ENDIF}
  1661. {$DEFINE USE_SAFELOADLIBRARY}
  1662. {$DEFINE USE_INVALIDATE_MOD_CACHE}
  1663. {$ENDIF}
  1664. //important!!! iconv functions are defined in the libc.pas Novell Netware header.
  1665. //Do not define USE_ICONVUNIT
  1666. {$UNDEF USE_ICONV}
  1667. {$UNDEF USE_ICONV_UNIT}
  1668. {$UNDEF USE_ICONV_ENC}
  1669. {$DEFINE INT_THREAD_PRIORITY}
  1670. {$ENDIF}
  1671. {$IFNDEF USE_ICONV}
  1672. {$UNDEF USE_ICONV_UNIT}
  1673. {$UNDEF USE_ICONV_ENC}
  1674. {$ENDIF}
  1675. //IMPORTANT!!!!
  1676. //
  1677. //Do not remove this!!! This is to work around a conflict. In DCC, MACOS
  1678. //will mean OS X. In FreePascal, the DEFINE MACOS means MacIntosh System OS Classic.
  1679. {$IFDEF DCC}
  1680. // DCC defines MACOS for both iOS and OS X platforms, need to differentiate
  1681. {$IFDEF MACOS}
  1682. {$IFNDEF IOS}
  1683. {$DEFINE OSX}
  1684. {$DEFINE DARWIN}
  1685. {$ENDIF}
  1686. {$ENDIF}
  1687. {$ENDIF}
  1688. {$IFDEF FPC}
  1689. // FPC defines DARWIN for both OSX and iOS, need to differentiate
  1690. {$IFDEF DARWIN}
  1691. {$IFNDEF IOS}
  1692. {$DEFINE OSX}
  1693. {$ENDIF}
  1694. {$ENDIF}
  1695. {$IFDEF MACOS}
  1696. {$DEFINE MACOS_CLASSIC}
  1697. {$ENDIF}
  1698. {$ENDIF}
  1699. {
  1700. BSD 4.4 introduced a minor API change. sa_family was changed from a 16bit
  1701. word to an 8 bit byte and an 8 bit byte field named sa_len was added.
  1702. }
  1703. //Place this only after DARWIN has been defined for Delphi MACOS
  1704. {$IFDEF FREEBSD}
  1705. {$DEFINE SOCK_HAS_SINLEN}
  1706. {$ENDIF}
  1707. {$IFDEF DARWIN}
  1708. {$DEFINE SOCK_HAS_SINLEN}
  1709. {$ENDIF}
  1710. {$IFDEF HAIKU}
  1711. {$DEFINE SOCK_HAS_SINLEN}
  1712. {$ENDIF}
  1713. {$IFDEF MORPHOS}
  1714. {$DEFINE SOCK_HAS_SINLEN}
  1715. {$ENDIF}
  1716. // Do NOT remove these IFDEF's. They are here because InterlockedExchange
  1717. // only handles 32bit values. Some Operating Systems may have 64bit
  1718. // THandles. This is not always tied to the platform architecture.
  1719. {$IFDEF AMIGA}
  1720. {$DEFINE THANDLE_CPUBITS}
  1721. {$ENDIF}
  1722. {$IFDEF ATARI}
  1723. {$DEFINE THANDLE_32}
  1724. {$ENDIF}
  1725. {$IFDEF BEOS}
  1726. {$DEFINE THANDLE_32}
  1727. {$ENDIF}
  1728. {$IFDEF BSD}
  1729. //I think BSD might handle FreeBSD, NetBSD, OpenBSD, and Darwin
  1730. {$IFDEF IOS}
  1731. {$IFDEF CPUARM64}
  1732. {$DEFINE CPU64}
  1733. {$DEFINE THANDLE_64}
  1734. {$ELSE}
  1735. {$IFDEF CPUARM32}
  1736. {$DEFINE CPU32}
  1737. {$ENDIF}
  1738. {$DEFINE THANDLE_32}
  1739. {$ENDIF}
  1740. {$ENDIF}
  1741. {$IFDEF OSX}
  1742. {$IFDEF FPC}
  1743. {$DEFINE THANDLE_32}
  1744. {$ELSE}
  1745. {$DEFINE THANDLE_CPUBITS} // !!! ADDED OSX BY EMBT
  1746. {$ENDIF}
  1747. {$ENDIF}
  1748. {$ENDIF}
  1749. {$IFDEF EMBEDDED}
  1750. {$DEFINE THANDLE_CPUBITS}
  1751. {$ENDIF}
  1752. {$IFDEF EMX}
  1753. {$DEFINE THANDLE_32}
  1754. {$ENDIF}
  1755. {$IFDEF GBA}
  1756. {$DEFINE THANDLE_32}
  1757. {$ENDIF}
  1758. {$IFDEF GO32}
  1759. {$DEFINE THANDLE_32}
  1760. {$ENDIF}
  1761. {$IFDEF HAIKU}
  1762. {$DEFINE THANDLE_32}
  1763. {$ENDIF}
  1764. {$IFDEF LINUX}
  1765. {$IFDEF LINUX64}
  1766. {$DEFINE CPU64}
  1767. {$DEFINE THANDLE_64}
  1768. {$ELSE}
  1769. {$IFDEF LINUX32}
  1770. {$DEFINE CPU32}
  1771. {$ENDIF}
  1772. {$DEFINE THANDLE_32}
  1773. {$ENDIF}
  1774. {$ENDIF}
  1775. {$IFDEF MACOS_CLASSIC}
  1776. {$DEFINE THANDLE_CPUBITS}
  1777. {$ENDIF}
  1778. {$IFDEF MORPHOS}
  1779. {$DEFINE THANDLE_CPUBITS}
  1780. {$ENDIF}
  1781. {$IFDEF NATIVENT} //Native NT for kernel level drivers
  1782. {$DEFINE THANDLE_CPUBITS}
  1783. {$ENDIF}
  1784. {$IFDEF NDS}
  1785. {$DEFINE THANDLE_32}
  1786. {$ENDIF}
  1787. {$IFDEF NETWARE}
  1788. {$DEFINE THANDLE_32}
  1789. {$ENDIF}
  1790. {$IFDEF NETWARELIBC}
  1791. {$DEFINE THANDLE_32}
  1792. {$ENDIF}
  1793. {$IFDEF OS2}
  1794. {$DEFINE THANDLE_32}
  1795. {$ENDIF}
  1796. {$IFDEF PALMOS}
  1797. {$DEFINE THANDLE_32}
  1798. {$ENDIF}
  1799. {$IFDEF SOLARIS}
  1800. {$DEFINE THANDLE_32}
  1801. {$ENDIF}
  1802. {$IFDEF SYMBIAN}
  1803. {$DEFINE THANDLE_32}
  1804. {$ENDIF}
  1805. {$IFDEF WII}
  1806. {$DEFINE THANDLE_32}
  1807. {$ENDIF}
  1808. {$IFDEF WATCOM}
  1809. {$DEFINE THANDLE_32}
  1810. {$ENDIF}
  1811. {$IFDEF WINDOWS}
  1812. {$DEFINE THANDLE_CPUBITS}
  1813. {$ENDIF}
  1814. // end platform specific stuff for THandle size
  1815. {$IFDEF THANDLE_CPUBITS}
  1816. {$IFDEF CPU64}
  1817. {$DEFINE THANDLE_64}
  1818. {$ELSE}
  1819. {$DEFINE THANDLE_32}
  1820. {$ENDIF}
  1821. {$ENDIF}
  1822. {$IFDEF DOTNET}
  1823. {$DEFINE DOTNET_OR_ICONV}
  1824. {$ENDIF}
  1825. {$IFDEF USE_ICONV}
  1826. {$DEFINE DOTNET_OR_ICONV}
  1827. {$ENDIF}
  1828. {$UNDEF STREAM_SIZE_64}
  1829. {$IFDEF FPC}
  1830. {$DEFINE STREAM_SIZE_64}
  1831. {$ELSE}
  1832. {$IFDEF VCL_6_OR_ABOVE}
  1833. {$DEFINE STREAM_SIZE_64}
  1834. {$ENDIF}
  1835. {$ENDIF}
  1836. {$IFNDEF FREE_ON_FINAL}
  1837. {$IFNDEF DOTNET}
  1838. {$IFDEF HAS_System_RegisterExpectedMemoryLeak}
  1839. {$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
  1840. {$ENDIF}
  1841. {$IFDEF USE_FASTMM4}
  1842. {$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
  1843. {$ENDIF}
  1844. {$IFDEF USE_MADEXCEPT}
  1845. {$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
  1846. {$ENDIF}
  1847. {$IFDEF USE_LEAKCHECK}
  1848. {$DEFINE REGISTER_EXPECTED_MEMORY_LEAK}
  1849. {$ENDIF}
  1850. {$ENDIF}
  1851. {$ENDIF}
  1852. {
  1853. We must determine what the SocketType parameter is for the Socket function.
  1854. In DotNET, it's SocketType. In Kylix and the libc.pas Kylix-compatibility
  1855. library, it's a __socket_type. In BaseUnix, it's a C-type Integer. In Windows,
  1856. it's a LongInt.
  1857. }
  1858. {$UNDEF SOCKETTYPE_IS_SOCKETTYPE}
  1859. {$UNDEF SOCKETTYPE_IS_CINT}
  1860. {$UNDEF SOCKETTYPE_IS___SOCKETTYPE}
  1861. {$UNDEF SOCKETTYPE_IS_LONGINT}
  1862. {$UNDEF SOCKETTYPE_IS_NUMERIC}
  1863. {$UNDEF SOCKET_LEN_IS_socklen_t}
  1864. {$IFDEF DOTNET}
  1865. {$DEFINE SOCKETTYPE_IS_SOCKETTYPE}
  1866. {$ENDIF}
  1867. {$IFDEF USE_BASEUNIX}
  1868. {$DEFINE SOCKETTYPE_IS_CINT}
  1869. {$DEFINE SOCKETTYPE_IS_NUMERIC}
  1870. {$ENDIF}
  1871. {$IFDEF KYLIXCOMPAT}
  1872. {$DEFINE SOCKETTYPE_IS___SOCKETTYPE}
  1873. {$ENDIF}
  1874. {$IFDEF USE_VCL_POSIX}
  1875. {$DEFINE SOCKETTYPE_IS_NUMERIC}
  1876. {$DEFINE SOCKETTYPE_IS_LONGINT}
  1877. {$DEFINE SOCKET_LEN_IS_socklen_t}
  1878. {$ENDIF}
  1879. {$IFDEF WINDOWS}
  1880. {$DEFINE SOCKETTYPE_IS_LONGINT}
  1881. {$DEFINE SOCKETTYPE_IS_NUMERIC}
  1882. {$ENDIF}
  1883. {$IFDEF OS2}
  1884. {$DEFINE SOCKETTYPE_IS_LONGINT}
  1885. {$DEFINE SOCKETTYPE_IS_NUMERIC}
  1886. {$ENDIF}
  1887. {$IFDEF NETWARE}
  1888. {$DEFINE SOCKETTYPE_IS_LONGINT}
  1889. {$DEFINE SOCKETTYPE_IS_NUMERIC}
  1890. {$ENDIF}
  1891. {Take advantage of some TCP features specific to some stacks.
  1892. They work somewhat similarly but there's a key difference.
  1893. In Linux, TCP_CORK is turned on to send fixed packet sizes and
  1894. when turned-off (uncorked), any remaining data is sent. With
  1895. TCP_NOPUSH, this might not happen and remaining data is only sent
  1896. before disconnect. TCP_KEEPIDLE and TCP_KEEPINTVL so the IFDEF LINUX and IFDEF
  1897. SOLARIS instead of IFDEF UNIX is not an error, it's deliberate.}
  1898. {$UNDEF HAS_TCP_NOPUSH}
  1899. {$UNDEF HAS_TCP_CORK}
  1900. {$UNDEF HAS_TCP_KEEPIDLE}
  1901. {$UNDEF HAS_TCP_KEEPINTVL}
  1902. {$UNDEF HAS_SOCKET_NOSIGPIPE}
  1903. {$IFDEF BSD}
  1904. {$DEFINE HAS_TCP_NOPUSH}
  1905. {$ENDIF}
  1906. {$IFDEF HAIKU}
  1907. {$DEFINE HAS_TCP_NOPUSH}
  1908. {$ENDIF}
  1909. {$IFDEF LINUX}
  1910. {$DEFINE HAS_TCP_CORK}
  1911. {$DEFINE HAS_TCP_KEEPIDLE}
  1912. {$DEFINE HAS_TCP_KEEPINTVL}
  1913. {$ENDIF}
  1914. {$IFDEF SOLARIS}
  1915. {$DEFINE HAS_TCP_CORK}
  1916. {$ENDIF}
  1917. {$IFDEF NETBSD}
  1918. {$DEFINE HAS_TCP_CORK}
  1919. {$DEFINE HAS_TCP_KEEPIDLE}
  1920. {$DEFINE HAS_TCP_KEEPINTVL}
  1921. {$ENDIF}
  1922. {$IFDEF USE_VCL_POSIX}
  1923. // TODO: which platforms actually have SO_NOSIGPIPE available?
  1924. {$DEFINE HAS_SOCKET_NOSIGPIPE}
  1925. {$IFDEF ANDROID}
  1926. {$UNDEF HAS_SOCKET_NOSIGPIPE}
  1927. {$ENDIF}
  1928. {$IFDEF LINUX}
  1929. {$UNDEF HAS_SOCKET_NOSIGPIPE}
  1930. {$ENDIF}
  1931. {$ENDIF}
  1932. {end Unix OS specific stuff}
  1933. {$IFDEF DEBUG}
  1934. {$UNDEF USE_INLINE}
  1935. {$UNDEF USE_CLASS_INLINE}
  1936. {$ENDIF}
  1937. // RLebeau 5/24/2015: In C++Builder 2006 and 2007, UInt64 is emitted as
  1938. // signed __int64 in HPP files instead of as unsigned __int64. This causes
  1939. // conflicts in overloaded routines that have (U)Int64 parameters. This
  1940. // was fixed in C++Builder 2009. For compilers that do not have a native
  1941. // UInt64 type, or for C++Builder 2006/2007, let's define a record type
  1942. // that can hold UInt64 values...
  1943. {$IFDEF HAS_UInt64}
  1944. {$IFDEF BROKEN_UINT64_HPPEMIT}
  1945. {$DEFINE TIdUInt64_HAS_QuadPart}
  1946. {$ENDIF}
  1947. {$ELSE}
  1948. {$IFNDEF HAS_QWord}
  1949. {$DEFINE TIdUInt64_HAS_QuadPart}
  1950. {$ENDIF}
  1951. {$ENDIF}
  1952. // RLebeau 9/5/2013: it would take a lot of work to re-write Indy to support
  1953. // both 0-based and 1-based string indexing, so we'll just turn off 0-based
  1954. // indexing for now...
  1955. {$IFDEF HAS_DIRECTIVE_ZEROBASEDSTRINGS}
  1956. {$ZEROBASEDSTRINGS OFF}
  1957. {$ENDIF}