IdCompilerDefines.inc 52 KB

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