On Thu, 19 Feb 2026, Marc Weustink via fpc-pascal wrote:



On 18/02/2026 10:34, Tony Whyman via fpc-pascal wrote:
Supplementing my point below, I went back and checked my notes. The TObject layout post 3.2 (in my copy of trunk) is now

        TObject = class
        {$IFDEF SYSTEM_HAS_FEATURE_MONITOR}
        strict private
           _MonitorData : Pointer;
        private
          function SetMonitorData(aData,aCheckOld : Pointer) : Pointer; inline;
           function GetMonitorData: Pointer; inline;
        {$ENDIF}
        protected
           function GetDisposed : Boolean; inline;
           Property Disposed : Boolean Read GetDisposed;
        public

with everything before "public" having been added. The big change is the addition of "_MonitorData". This bumps the offset of all later fields up by sizeof(pointer). If you have code that makes assumptions about the object layout - and this very much applies to code that tries to import an object from C++ then your previous assumptions are invalid.

Pfew.. when you initially wrote your "observations" I didn't realize this issue. In our product, based on old delphi code, an object is used as "record with methods" to interface with various IP based systems.

if you are referring to old TP style objects, your code is unaffected.
It only applies to Delphi-style objects.

Michael.
_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to