Am 09.09.2022 um 00:49 schrieb Hairy Pixels via fpc-pascal:
On Sep 8, 2022, at 11:14 AM, Michael Van Canneyt via fpc-pascal 
<fpc-pascal@lists.freepascal.org> wrote:

It must keep this information somewhere, but this does not mean you can 
typecast it to a TMethod.
Indeed. I wonder if this information could be exposed by some method in the 
interface? It would be useful to introspect the target class like you can do 
with “of object”.

See the announcement email from Sven to the fpc-pascal mailing list: https://lists.freepascal.org/pipermail/fpc-pascal/2022-May/060507.html

They [function references] get their great power from a point that is for once *not*
considered an implementation detail: function references are in fact
internally declared as reference counted interfaces with a single
Invoke() method of the provided signature. So the above examples are in
fact declared like this:

=== code begin ===

type
   TProcLongInt = interface(IInterface)
     procedure Invoke(aArg: LongInt); stdcall; overload;
   end;

You should be able to get the Invoke procedure pointer from the RTTI.

Ondrej

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to