Adrian Maire
Adrian Maire

Reputation: 14875

How to translate `reference to procedure` from Delphi to Lazarus?

Disclaim: I am asking to "Lazarus" because I don't really care about mode Delphi or mode ObjFPC...

I am translating some code from "Delphi 11" to Lazarus and found those:

TProc = reference to procedure(const AControl: TControl);
....
proc := MyProcedure;

This seems to be some managed reference to method for event callback, if I am correct.

How would I make something equivalent under Lazarus ?

Upvotes: 0

Views: 660

Answers (1)

Stefan Glienke
Stefan Glienke

Reputation: 21758

You can use FPC from the main branch, which has this feature since May of last year. However, it will only be in the next major version release, which is not on the horizon, as far as I know.

Official announcement of the feature:

Feature announcement: Function References and Anonymous Functions

Upvotes: 5

Related Questions