Debugging external dll with Delphi - delphi

I would like to look at real symbols for an external dll compiled with bcc (bcc32) inside Delphi debugging. The problem is that it seems that bcc only allows externals symbols (tds file) and delphi does not see this symbols. So is there a way to force bcc32/ilink32 to embed symbols inside the dll or Delphi to understand dll with tds symbols?
Thank you,
Max

Try your project using C++ Builder: that allows you to integrate your Delphi and C++ code in one project (or have multiple projects in one project group: a C++ DLL and a Delphi host).
Since they use the same debugging format, it is way easier to debug.

Related

Delphi DualListBox module - where to find?

I am supporting some legacy Delphi project. This project is divided into modules that stored in DLLs.
I need to compile one of the modules (last compiled in 2007). This module uses module DualListBox and has a variable of type TDualListBox:
uses DualListBox ....;
...
lbMasterOrders: TDualListBox;
lbChildOrders: TDualListBox;
The problem is, I don't know where to find module DualListBox. I can't find it on my machine, and I can't find it on the internet.
As far as I understand, the TDualListBox component must be something like ListBox that can Add rows at runtime.
At first, i thought that DualListBox is a part of RxLib, but RxLib's component is called DualListDialog and it's something completely else.
So maybe this is the self-written module by prev developer, that was deleted somehow.
But somehow the compiled DLL (that was comiled in 2007) is working perfectly fine. Maybe I can investigate where to find that module by decompiling that DLL?
If so, where should I look in the decompiled project? I'm using DeDe for decompiling.
The unit is called duallist and is automatically generated by Delphi 2007 (and also Delphi 10.1 and 10.2, don't know about other versions, but I would be surprised if they didn't have it) when you open a VCL project and click:
File
New
Other
Delphi Projects
Delphi Files
Dual list box
These units are usually taken from the object repository, which by default is located in the ObjRepos subdirectory of the Delphi installation.

Delphi unit for msctf.h header file (from Platform SDK)?

Is there any Delphi unit available corresponding msctf.h header file from Platform SDK?
I have checked Delphi 2010 source folder, but it seems Delphi doesn't come with that.
Thanks in advance for your time!
You can use Visual Studio's MIDL to generate a type library (.tlb) from the .idl file and then use Delphi's tlibimp.exe to generate the Delphi interface unit.
The problem with the original .idl is that it doesn't contain a library statement so I added it manually (otherwise MIDL wouldn't generate the .tlb).
See if the result helps you (you may still need to fix some parts by hand).

Is it possible to debug a C++builder dll from Delphi if I have the dll sourcecode?

I have an application written in Delphi 7 which uses a c++ dll written in BCB 5.
I want to debug this dll from the Delphi IDE is this possible?
If it's possible which are the steps to debug?
As additional information I have the full source code of the dll.
It has been a while since I have dealt with C++ / Delphi together. But if I remember correctly, you can use the BCB IDE to run the Delphi application (compiled already) that uses your DLL. Basically, in your project settings in BCB, you can set a program to run when you click the "run" button, and I believe that you will be able to set breakpoints and stuff that will be caught when functions of your DLL are being called by that application. Still, this implies that you have BCB.
My recollection, and it's been a while since I last tried this, is that you need the C++ Builder IDE to do this.
It should be possible:
I have done it quite often to debug a BCB5 dll within the Delphi 6 IDE. My delphi 6 application uses the DLL and I can then step from the delphi code into the bcb code (and back). So I might work with Delphi 7 too.
Delphi isn't configured by default to do that. At that time I found an explanation on the web how to do it. Not sure, but it might have been the following page: http://www.delphifaq.com/faq/delphi/delphi_ide/f178.shtml
You will also need to compile the dll in debug mode and to indicate the path to the source code of the dll in the project options of your delphi application.

Upgrading to HTMLHelpViewer in DELPHI XE (Can't find HTMLHelpViewer.pas)

I am upgrading from Delphi 6 to Delphi XE. In Delphi 6 I was using HTML help files (.chm) and used the StoHtmlHelp to make it so that I could call context sensitive help like we used to call .hlp files. I'm upgrading to Delphi XE so I need to use that native HTML help support.
I know I'm supposed to add HTMLHelpViewer to the uses clause of the project, but when I do I get a compiler warning that it couldn't find the file.
Could not compile used unit 'HTMLHelpViewer.pas'
Does anyone know why Delphi isn't finding this file by default? It should be built in.
Not being able to compile a file and not finding a file arent't the same thing. If Delphi is trying to compile HTMLHelpViewer.pas you must either:
have the vcl source folder(s) on your library path (not recommended), or
another HTMLHelpViewer.pas file is somewhere on your library path, that path comes before the standard Delphi lib folder, and that HTMLHelpViewer.pas file contains something that Delphi XE is not happy about.
The first is not likely and it would be very strange indeed if Delphi could not compile one of its units (apart from system.pas).
The second seems more likely... And if that unit used to compile, the complaints from Delphi XE could well be due to differences between Delphi 6 and Delphi XE.
You don't actually need to add it the uses clause of the .dpr file – you just need to use it from some unit in your project.
Having said that, you may actually prefer to add it to your .dpr file, and if so then do it like this:
uses
Forms,
HtmlHelpViewer,
MyUnit in 'MyUnit.pas',
I'm guessing that you have something like this:
uses
Forms,
HtmlHelpViewer in 'C:\Program Files\Borland\Delphi6\Source\VCL\HtmlHelpViewer.pas',
MyUnit in 'MyUnit.pas',
This will fail because you are asking XE to compile D6 source.
For RTL/VCL units its best to omit the path to the file and let the compiler find it (it knows where to look).

How to debug a DLL file built in VC++ with Delphi code?

I am a developer working on Delphi. In my project I have added a DLL file which is built in VC++. I need to debug the DLL file to fix some issues.
So what are the steps needed to follow in order to debug DLL file with Delphi code?
You cannot debug the DLL from inside of Delphi, unless you do not mind stepping through the DLL's raw x86 assembly instructions. Otherwise, you need to load the DLL's source code into VC++ and use VC++'s debugger, specifying your Delphi application as the executable to use for the debugging session.
Probably you can also use Windows debugging tools (WinDbg) if you don't want to use VC++, but Delphi can't debug VC++ code because it has no support for its symbol files format.

Resources