[fpc-pascal] Need help with - howto find struct field

Marco van de Voort marcov at stack.nl
Fri Oct 10 14:06:10 CEST 2008


In our previous episode, Jan Kowalski said:
> Hi, I try to convert string to structure field. As example:
> 
>  function getRepF(argo,argn: string): boolean;
>  begin
>  ...
>        dataA.'argn':=argo;
>  ...
>  end;
> 
> argn is a string with name of structure (dataA) field. Is there any
> way to do that ? somethink like FindStructField ?

In general: no. In compiled languages, identifier names are generally
eliminated in the compilation process.

There are remote cases possible for classes (RTTI/introspection), but these
are special cases. See the examples for e.g. unit typinfo.
 



More information about the fpc-pascal mailing list