Is it possible to get the value of a GUID on an interface using RTTI?

亡梦爱人 提交于 2020-12-25 00:38:00

问题


If I have an interface such as:

IPluginAPI = interface
['{590DFF0B-CA00-46CC-84B0-3848103D4C5A}']
   function add (a : double; b : double) : double;
   function sub (a : double; b : double) : double;
   function mult (a : double; b : double) : double;
   function divide (a : double; b : double) : double;
end;

Is there anyway to get the value of the GUID using RTTI? I am using Delphi XE.


回答1:


uses
  TypInfo;

Guid := GetTypeData(TypeInfo(IPluginAPI))^.Guid;


来源:https://stackoverflow.com/questions/8439246/is-it-possible-to-get-the-value-of-a-guid-on-an-interface-using-rtti

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!