efortier 0 Posted August 18, 2019 Hi all, I'm trying to find what is the meaning of those and what the compiler does with variables declared with with either [out] or [in], like these: TMyRecord = record [in] SrcPosition: TPoint; [out] DstPosition: TPoint; end; I've been trying to search on google and in the doc, but all I can find is references to the normal in and out keywords. Thanks! Share this post Link to post
David Heffernan 2345 Posted August 18, 2019 Where are the attributes defined? Share this post Link to post
Lars Fosdal 1792 Posted August 19, 2019 VCL.Forms, VCL.Printers and VCL.StdCtrls has a few of these, but for only for function parameters in CLR code. {$IF DEFINED(CLR)} type TMonitorEnumerator = class FList: TList; FEnumProc: TMonitorEnumProc; // reference to the delegate so the garbage collector doesnt free it constructor Create(List: TLIst); function EnumMonitorsProc(hm: HMONITOR; dc: HDC; [in] var r: TRect; Data: LPARAM): Boolean; end; {$ENDIF} and on the topic of CLR: https://stackoverflow.com/questions/2210122/why-are-there-so-many-if-definedclr-in-the-vcl-rtl Yeah... that stuff really should be made to go away. 1 Share this post Link to post
Uwe Raabe 2057 Posted August 19, 2019 Indeed ,NET has something called InAttribute and OutAttribute. AFAIK, there is no corresponding thing in Delphi. Share this post Link to post
Remy Lebeau 1394 Posted August 21, 2019 On 8/19/2019 at 2:17 AM, Lars Fosdal said: VCL.Forms, VCL.Printers and VCL.StdCtrls has a few of these, but for only for function parameters in CLR code. Right, such examples are using [in] and [out] only for function parameters, not for record fields like in efortier's example. I've never seen such attributes used on fields. Share this post Link to post
Микола Петрівський 10 Posted August 22, 2019 In modern Delphi you can do that like this: TMyRecord = record private FSrcPosition: TPoint; function GetDestination: TPoint; public property SrcPosition: TPoint write FSrcPosition; property DstPosition: TPoint read GetDestination; end; Share this post Link to post