I have a pointer to functions like this.
TTestEvent = function(): Boolean;
procedure ExecuteTest(aTest: TTestEvent; aType: String);
begin
if aTest then
NotifyLog(aType + ' success')
else
TestError(aType + ' failed');
end;
// Call the test
procedure TestAll;
begin
ExecuteTest(LoadParcels, 'LoadParcel');
end;
But it would be even nicer to extract the name of the function from the functionpointer aTest.
So instead of
aType + ' success'
I want something like
ExtractName(aTest) + ' success'
Can this be done in Delphi 2007 ?
You cannot do this with built-in features. In order to get a function name from an address you need to know the map of the executable. This is not part of an executable unless you take steps to add it.
Debugging tools like JclDebug and madExcept offer the functionality you are looking for.