#1 2023-04-16 17:38:24

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 430

Managed records are not recognized by rtti and can not be serialiazed

Delphi added the typeinfo type tkMRecord (managed records) that it is not included in TRttiKind and this causes an out of range error and can not be serialized

Offline

#2 2023-04-17 12:58:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: Managed records are not recognized by rtti and can not be serialiazed

I don't have access to the latest Delphi revision.

Oddly enough, this seems not reflected in the documentation:
https://docwiki.embarcadero.com/Librari … .TTypeKind

So I have a add a rkMRecord after rkProcedure, right?

Do you know if the RTTI layout changed a lot in respect to regular tkRecord ?

Offline

#3 2023-04-17 13:42:55

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 430

Re: Managed records are not recognized by rtti and can not be serialiazed

// Sync with compiler internals
  TTypeKind = (tkUnknown, tkInteger, tkChar, tkEnumeration, tkFloat,
    tkString, tkSet, tkClass, tkMethod, tkWChar, tkLString, tkWString,
    tkVariant, tkArray, tkRecord, tkInterface, tkInt64, tkDynArray, tkUString,
    tkClassRef, tkPointer, tkProcedure, tkMRecord);


https://docwiki.embarcadero.com/RADStud … ed_Records

Offline

#4 2023-04-19 07:59:41

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: Managed records are not recognized by rtti and can not be serialiazed

So the Delphi documentation is not accurate. sad

I have added minimal managed records support on latest Delphi.
Please see
https://github.com/synopse/mORMot2/commit/274f996a

But we don't support custom initialization/finalization yet: a managed record is just filled with zero, and its managed fields memory released (similar limitation applies to FPC managed records).

Thanks for the feedback.

Offline

#5 2023-04-19 08:04:46

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 430

Re: Managed records are not recognized by rtti and can not be serialiazed

Thanks a lot @ab

Offline

Board footer

Powered by FluxBB