Giter VIP home page Giter VIP logo

Comments (5)

synopse avatar synopse commented on May 18, 2024

This function does what it is documented to do: " get the dynamic array type information of the stored item"
So if there is no stored item, elType is nil.

What do you want to achieve?
If you want to access the RTTI as mORMot does, use TRttiCustom and its properties, e.g. Cache.ItemSize.

Please use the forum to discuss this.

from mormot2.

mksjgj avatar mksjgj commented on May 18, 2024

program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
System.SysUtils,
mormot.core.rtti;

type
PSimpleLocator = ^TSimpleLocator;
TSimpleLocator = packed record
Id:Int32;
Pos: Int32;
end;
TSimpleLocatorArray = array of TSimpleLocator;

var
FXLocArrTyp :PRttiInfo;
sz:Integer;
begin
FXLocArrTyp := TypeInfo(TSimpleLocatorArray);

sz := FXLocArrTyp.DynArrayItemSize;
WriteLn('DynArrayItemSize: ItemSize is ' + sz.ToString); //DynArrayItemSize: ItemSize is 0

FXLocArrTyp.DynArrayItemType(sz);
WriteLn('DynArrayItemType: ItemSize is ' + sz.ToString); //DynArrayItemType: ItemSize is 8

WriteLn('You can see, something is wrong!');
end.

from mormot2.

synopse avatar synopse commented on May 18, 2024

I guess you are using Delphi, not FPC?

from mormot2.

mksjgj avatar mksjgj commented on May 18, 2024

yes delphi 10.3.3

from mormot2.

synopse avatar synopse commented on May 18, 2024

Should be fixed now.

Thanks for the feedback.

But anyway, you should better use TRttiCustom and its properties, e.g. Cache.ItemSize, rather than those lower level functions.

from mormot2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.