Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

delphi

rtti

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.

like image 648
rhody Avatar asked Dec 08 '11 23:12

rhody


1 Answers

uses
  TypInfo;

Guid := GetTypeData(TypeInfo(IPluginAPI))^.Guid;
like image 174
Ondrej Kelle Avatar answered Nov 02 '22 13:11

Ondrej Kelle