[fpc-pascal] Get TMethod from function reference
Hairy Pixels
genericptr at gmail.com
Thu Sep 8 16:55:02 CEST 2022
A function reference can call a class method but can you get the TMethod data from function references? It was possible with “is object” to cast to TMethod but that doesn’t seem to be possible with references.
=========
type
TMyClass = class
constructor Create;
procedure DoThis;
end;
constructor TMyClass.Create;
var
proc: reference to procedure;
begin
proc := @DoThis;
writeln(Assigned(PMethod(proc)^.data)); // FALSE
end;
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list