Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Delphi's various function pointer access.
procedure TForm1.test1; begin ShowMessage('procedure test1() //TThreadMethod.'); end;
procedure TForm1.FormCreate(Sender: TObject);
var
test_proc: TThreadMethod;
test_prop: Pointer;
procedure test();
begin
ShowMessage('procedure test() //procedure pointer.');
end;
procedure exect(const pro1: TProc);
begin
ShowMessage('procedure texect(const pro1: TProc)');
pro1();
end;
begin
test_prop := @test;
test_proc := test1;
exect(TProcedure(test_prop)); //procedure pointer.
exect(test_proc);
exect(procedure begin ShowMessage('Generic Anonymous method.'); end);
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment