delphi – 从functionpointer获取functionname?
发布时间:2020-12-15 09:38:13 所属栏目:大数据 来源:网络整理
导读:我有一个指向这样的函数的指针. TTestEvent = function(): Boolean;procedure ExecuteTest(aTest: TTestEvent; aType: String);begin if aTest then NotifyLog(aType + ' success') else TestError(aType + ' failed');end;// Call the testprocedure TestAl
我有一个指向这样的函数的指针.
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; 但是从functionpointer aTest中提取函数的名称会更好. 而不是 aType + ' success' 我想要类似的东西 ExtractName(aTest) + ' success' 这可以在Delphi 2007中完成吗? 解决方法
您无法使用内置功能执行此操作.要从地址获取函数名称,您需要知道可执行文件的映射.除非您采取措施添加它,否则这不是可执行文件的一部分.
JclDebug和madExcept等调试工具提供了您正在寻找的功能. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |