|
Interfaces with GUID |
Top Previous Next |
|
What is translated > Types > Records, Classes, Interfaces > Interfaces > Non-generic interfaces > GUID's > Interfaces with GUID An example of an Interface with a GUID in Delphi is:
type IFoo = interface ['{12345678-1234-1234-1234-1234567890AB}'] procedure DoSomething; end;
This definition will be converted differently depending on the target:
C++Builder
__interface INTERFACE_UUID("{12345678-1234-1234-1234-1234567890AB}") IFoo: public System::IInterface // ancestor added by Delphi2Cpp { virtual void __fastcall DoSomething() = 0; };
C++
struct D2C_UUID("12345678-1234-1234-1234-1234567890AB") IFoo: public virtual System::IInterface // ancestor added by Delphi2Cpp : public IInterface { virtual void DoSomething() = 0; };
#ifdef IS_PORTABLE DEFINE_UUIDOF(IFoo, "12345678-1234-1234-1234-1234567890AB") #endif // IS_PORTABLE
D2C_UUID expands to __declspec(uuid(...)) under MSVC and to nothing elsewhere.
DEFINE_UUIDOF provides the portable __d2c_uuidof<IFoo>() specialization and registers the GUID in TGuidRegistry.
|
|
This page belongs to the Delphi2Cpp Documentation |
Delphi2Cpp home Content |