GUID's

Top  Previous  Next

What is translated > Types > Records, Classes, Interfaces > Interfaces > Non-generic interfaces > GUID's

Delphi interfaces may declare a GUID (['{...}']). With a GUID, they are COM-compatible; without a GUID, they are purely Delphi-specific. In Delphi, both kinds of interfaces work seamlessly with as and Supports, because the compiler and RTL provide implicit support through interface tables.

 

When translating to C++, Delphi2Cpp must preserve the ability to resolve and cast interfaces dynamically. For this reason, every interface must have a stable identifier (GUID), regardless of whether one was originally defined in Delphi.

 

 

1) Interfaces with a GUID in Delphi

2) Interfaces without a GUID in Delphi

 

 

Advantages:

 

Enables runtime interface lookup, such as QueryInterface or Supports(...).

 

Preserves compatibility with Delphi’s COM-inspired interface model.

 

Supports Delphi-specific features like as, is, and interface casting semantics.

 

In portable C++ mode, allows custom RTTI and interface table generation (e.g. via InterfaceTableGenerator).



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content