[fpc-pascal] FieldAddress

Torsten Bonde Christiansen tc at epidata.info
Tue Feb 3 10:17:15 CET 2015


Hi,

What does it take for a class to access a field using FieldAddress(...)?

I have tried with both typeinfo on/off ({M+}), placing the field in 
private/protected/public/published
sections but to no avail.

My simple code is:

TMyObject = class
private
   FRef: TMyObject;
   procedure SetRef(AValue: TMyObject);
public
   property Ref: TMyObject read FRef write SetRef;
end;


then i have tried to get the adress in two ways:

AMyObject.FieldAddress('FRef');   //returns nil
AMyObject.FieldAddress('Ref'); //also returns nil

If i run my code through debugger, the VMT FieldTable is empty 
suggesting no information is
created. This happens in all cases of typeinfo on/off and differenc 
sections...

What can i do to make the fieldadress accessible?

Regards,
Torsten.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150203/d72a79f2/attachment.html>


More information about the fpc-pascal mailing list