Interfaces

Top  Previous  Next

What is translated > Types > Records, Classes, Interfaces > Interfaces

Delphi interfaces provide a mechanism to separate implementation details from their usage.

Historically, they are based on the Component Object Model (COM) and are COM-compatible by default.

Unlike classes, interfaces support multiple inheritance, making them particularly well-suited for component-based architectures that rely on abstraction and loose coupling.

 

In Delphi2Cpp, interface translation is divided into two categories:

 

Non-generic interfaces

 

These follow the traditional Delphi/COM model. They are GUID-based, reference-counted, and support runtime type resolution (as<T>, Supports).

Non-generic interfaces are the backbone of component design and interop scenarios.

 

Generic interfaces

 

These are mostly used in the Delphi RTL’s generics framework (IComparer<T>, IEqualityComparer<T>).

Generic interfaces do not have GUIDs, do not participate in reference counting, and are not used with Supports or as<T>. Instead, they are consumed through static factories (e.g. TComparer<T>::Default), and serve as lightweight contracts for algorithms and collections.

 

 

 

> **Note** 

> The interface translation in Delphi2Cpp is limited to standard, v-table-based interfaces. 

> Dispinterface constructs and full COM automation via `IDispatch` are not supported. 

> The goal is not to build a complete COM interop layer, but to provide a Delphi-compatible C++ representation.

 

 

 

 

 

 



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content