Below is an example of how to reproduce it:
In Delphi create a project and add this (below) to a new unit called
uDelphi.pas.
unit uDelphi;
interface
uses Classes;
type
TMyClass= class(TComponent)
public
class function GetId: integer; virtual;
property Id: Integer read GetId;
end;
implementation
class function TMyClass.GetId: Integer;
begin
Result := 1;
end;
end.
Now in BCB we are going to create a new project and use uDelphi.pas within
it:
So create a new BCB Form project and place a TButton on the form.
Now add the 'uDelphi.pas' file to your BCB project.
Add the include of the 'uDelphi' file:
#include "uDelphi.hpp"
In the OnClick event of the Button place the following code:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int i;
TMyClass *mc = new TMyClass(NULL);
i = mc->Id;
delete mc;
}
Now compile your BCB project and you will see the now mangled header file.
I get the following error:
[C++ Error] uDelphi.hpp(31): E2347 Parameter mismatch in read access
specifier of property Id
This is how my header looks:
namespace Udelphi
{
//-- type
declarations -------------------------------------------------------
class DELPHICLASS TMyClass;
class PASCALIMPLEMENTATION TMyClass : public Classes::TComponent
{
typedef Classes::TComponent inherited;
public:
/* virtual class method */ virtual int __fastcall GetId(TMetaClass* vmt);
<----PROBLEM
__property int Id = {read=GetId, nodefault};
public:
#pragma option push -w-inl
/* TComponent.Create */ inline __fastcall virtual
TMyClass(Classes::TComponent* AOwner) : Classes::TComponent(AOwner) { }
#pragma option pop
#pragma option push -w-inl
/* TComponent.Destroy */ inline __fastcall virtual ~TMyClass(void) { }
#pragma option pop
};
Can someone else try this to confirm what I have found?
Thanks