[fpc-pascal] defining record at runtime
Leonardo M. Ram�
martinrame at yahoo.com
Wed Sep 26 04:59:08 CEST 2007
An aproximation of what you want to accomplish is the usage of classes (descendants of
TPersistent) with published properties accesed using RTTI. The "visible" fields you want to access
are these published properties, all other information and methods can't be accessed using RTTI.
TCustomer = class(TPersistent)
property Age: Integer read FAge write FAge;
property Name: string read FName write FName;
--- Marc Santhoff <M.Santhoff at t-online.de> wrote:
> Am Dienstag, den 25.09.2007, 11:56 +0200 schrieb Jonas Maebe:
> > On 25 Sep 2007, at 11:49, Marc Santhoff wrote:
> > > would it be possible to set up a memory structure according to fpc's
> > > aligning rules that will be accepted as a record typed variable? Or
> > > does
> > > fpc create some informational support items that would miss in this
> > > case?
> > >
> > > I'm in doubt, since it is normally not possible (AFAIK, tell me if
> > > this
> > > is wrong) to get structural information about a record type at runtime
> > > (no RTTI).
> > Initialisation rtti is generated in case the record contains
> > reference counted types. It will be easier to answer your question if
> > you explain what you want to achieve and why.
> I was a little fast in asking this question. It's about passing around
> arbitrary anonymous record consisting of atomic types and strings.
> But since in the end it all comes down to asking for a records members
> and field count I have to use additional typing info and doing the
> memory housekeeping by hand anyways. (If this hasn't changed since fpc
> So forgat about it.
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
More information about the fpc-pascal