-5

I am trying to use a Delphi component and the callback function needs to be implemented as a

typedef System::DelphiInterface<TButtonCallBack> _di_TButtonCallBack;

which is defined in the C++ header file as:

__interface TButtonCallBack : public System::IInterface
{
  virtual void __fastcall Invoke(TConfirmButton ConfirmButton) = 0;
};

How do I implement the above Delphi interface in C++Builder?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Aggie85
  • 83
  • 4
  • 5
    2.5 years and you still cannot format your code/questions or leave out formulating it as an email. Will you ever accept an answer? What happened to [Shane](https://stackoverflow.com/revisions/59850739/1)? – AmigoJack Aug 07 '22 at 20:57
  • I just dusted off my Wylber hat and looked at the formatting method of the editor! – Aggie85 Aug 07 '22 at 21:18
  • Who is "_Wylber_"? Also this is a duplicate of [How do you declare an interface in C++?](https://stackoverflow.com/a/318084/4299358). – AmigoJack Aug 07 '22 at 23:04
  • It is not a duplicate - my question was on Delphi Interfaces to C++ Builder not how to implement interfaces in pure C++. Wylbur is an ancient mainframe editor from 40+ years ago. – Aggie85 Aug 07 '22 at 23:17
  • how come this question is marked as "not focused"? – George Birbilis Aug 11 '22 at 12:13

1 Answers1

1

Ok I figured it out.

For others if it is helpful, the answer is below:

class TUniFSConfirmButtonInterface : public TCppInterfacedObject<TButtonCallBack>
{
    public:
    void __fastcall Invoke(TConfirmButton nButton)
    {
    }
};

All the best,

Aggie85!

Aggie85
  • 83
  • 4
  • This is covered in the documentation: [Implementing Interfaces: Delphi and C++](https://docwiki.embarcadero.com/RADStudio/en/Implementing_Interfaces:_Delphi_and_C%2B%2B) – Remy Lebeau Aug 08 '22 at 01:22
  • 1
    I was working off a slow internet connection and couldn't find it in the regular Rad Studio help. I moved to a different location on campus with REAL internet speeds, and voila! Easy solution. I forgot this is the same solution for FMX apps. – Aggie85 Aug 08 '22 at 01:29