Implementing IInterface works in VCL but not in FMX

  

I have this interface called “IViewFrame” its implementation is like this:

__interface INTERFACE_UUID(“{D307ACE9-FE13-4F11-BEEB-A15C908579BC}”) IViewFrame : public System::IInterface
{
//—————————————————————————
protected:
//Setters/Getters
virtual void __fastcall SetView(TView *Value) = 0;
virtual TView* __fastcall GetView() = 0;

//—————————————————————————
public:
//Fields/Properties
__property TView *View = {read = GetView, write = SetView};
//—————————————————————————
};
//—————————————————————————
typedef System::DelphiInterface<IViewFrame> _di_IViewFrame;

Now on VCL this interface is working fine here is the code:

class TVCLFrame : public TFrame, IViewFrame
{
__published: // IDE-managed Components

private:
//Fields
TView *FView;
//—————————————————————————
protected:
//Setters/Getters
virtual void __fastcall SetView(TView *Value);
virtual TView* __fastcall GetView();
public: // User declarations
__fastcall TVCLFrame(TComponent* Owner);

INTFOBJECT_IMPL_IUNKNOWN(TFrame);
};
//—————————————————————————

But when I do the same thing in an FMX Frame, I get a conflict error in INTFOBJECT_IMPL_IUNKNOWN:

class TFmxFrame : public TFrame, IViewFrame
{
__published: // IDE-managed Components
TBindingsList *BindingsList;
TBindSourceDB *BindSourceDB;
TBindNavigator *BindNavigator1;
private: // User declarations
TView *FView;

protected:
//Setters/Getters
virtual void __fastcall SetView(TView *Value);
virtual TView* __fastcall GetView();

public: // User declarations
__fastcall TFmxFrame(TComponent* Owner);

INTFOBJECT_IMPL_IUNKNOWN(TFrame); // I get the error here
};
//—————————————————————————

[bcc32 Error] FmxFrameU.h(50): E2113 Virtual function ‘__stdcall TFmxFrame::Release()’ conflicts with base class ‘TFmxObject’

Now I looked into TfmxObjct code and found out that there is another method called Release() that conflicts with the one from the IUnknown Interface.

How can I fix this issue? I want this interface to work for both VCL and FMX without any troubles.

Comments are closed.