3

I have a large project consisting of one exe (C++) and several dlls (C++) and bpl (delphi ). My target architecture is x64. I ran into a problem in bpl - package. When I tried to debug it, I saw that the breakpoints do not work: enter image description here

I made a minimal reproducible example. I made three clean projects (exe c++, exe delphi, bpl delphi) and wrote the code for them:

exe c++:

#include <vcl.h>

#include "Unit2.hpp"

#pragma comment(lib, "Package1")

int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
{
    TComponent* cmp = nullptr;
    Unit2::TForm2* frm = new Unit2::TForm2(cmp);
    frm->Button1Click(nullptr);
    return 0;
}

exe delphi:

unit Unit4;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Unit2;

type
  TForm4 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form4: TForm4;

implementation

{$R *.dfm}

procedure TForm4.FormCreate(Sender: TObject);
var
frm: TForm2;
begin
  frm := TForm2.Create(nil);
  frm.Button1Click(nil);
end;

end.

bpl delphi:

unit Unit2;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TForm2 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}



procedure TForm2.Button1Click(Sender: TObject);
var
i: integer;
begin
   i := 678;
end;

end.

I tested 4 debug combinations:

  1. exe (C++ x86) and bpl(delphi x86) - debug working
  2. exe (delphi x86) and bpl(delphi x86) - debug working
  3. exe (delphi x64) and bpl(delphi x64) - debug working
  4. exe (C++ x64) and bpl(delphi x64) - debug not working

Why doesn't the combination exe (C++ x64) and bpl(delphi x64) allow me to debug bpl? I don't know how to defeat my problem.

bpl project debug settings: enter image description here enter image description here

OS: Windows 10 x64

IDE: Embarcadero RAD Studio 11.2

Range
  • 416
  • 7
  • 20
  • I can replicate this in Rad Studio 11.1.5, but can't figure a way around it. I added in MadExcept to my project and made the delphi bpl cause an AV exception in the button click event. MadExcept didn't catch it - indicating there's something weird about this project's setup. This feels like a bug in RAD Studio - maybe time to raise a support case? – AndyB Jan 17 '23 at 12:51

0 Answers0