2022年7月23日 星期六

Delphi Compatibility Macros - RAD Studio

 https://docwiki.embarcadero.com/RADStudio/Sydney/en/Delphi_Compatibility_Macros

 OPENARRAY

#define OPENARRAY(type, values) \
   OpenArray<type>values, OpenArrayCount<type>values.GetHigh()

The OPENARRAY macro can be used as in the following example:

myProc(OPENARRAY(TVarRec,(1, 2, 3, 4, 5)))
      //in which case the expanded code looks like:
myProc(OpenArray<TVarRec>(1, 2, 3, 4, 5), OpenArrayCount<TVarRec>(1, 2, 3, 4, 5).GetHigh())
     //which corresponds to what Delphi methods expect.

The same technique is used for the rest of the macros.

 https://docwiki.embarcadero.com/RADStudio/Sydney/en/Predefined_Macros

 https://docs.devart.com/unidac/work_macros.htm