Link to home
Start Free TrialLog in
Avatar of mheacock
mheacock

asked on

Adding Delphi Components to C++ Builder

Just got C++ Builder...looks great...I'm not defecting though...will be using it to enhance some things...one peeve though...when will Borland get their help files right???

To the question:  I have two components directories: Registration and Source.  The source directory contains all the .PAS files that contain the componets classesa and relevant code.  The Registration directory contains a few .PAS files that contain only the minimum registration calls and the .DCU files of source files.  This all works like a charm in Delphi...I've separated things such, because in the past, during debugging, the integrated debugger had an annoying habit of popping into my component code...seems that a USES looks first for .PAS files then for .DCU files.

Anyhow, when I load up the registration .PAS file in C++ Builder and then go through the normal procedure for installing a component...during the component 'compile' and error pops up saying it cn't find XXX.pas.  So it obviously isn't looking for the .DCU file.  I was thinking I should add it to the project, except that C++ Builder won't give me access to any of the project options (the menu is grayed out).

So...what is the procedure for adding a Delphi-written component to C++ Builder???  Given how I have things set-up above?  I even tried compiling one of the .PAS source files to a .OBJ, but that didn't solve anything (besides I read that the .OBJs have to be in a special format and I'm not sure if Delphi 2 will create a .OBJ the C++ Builder is happy with).

I'm pretty sure this is a question between easy and moderate.  Correct me if I'm wrong and I'll adjust the points.
Avatar of sleach
sleach

I don't separate things the way you do, and I've had no trouble installing Delphi components into C++Builder.  Maybe you should try giving C++Builder what it wants, and put all the *.pas files into a single directory just for C++Builder.  It shouldn't take up much space, and will tell you if the file locations are really the problem.
Avatar of mheacock

ASKER

I have...the problem lies when I do integrated debugging...the
IDI debugger always pops into the code for my components.  This is really annoying.  The only way I got it to stop in Delphi 2 was to separate to have the registration .pas files located with the .DCUs of the source files.

So I can install my components into C++ Builder but there are annoying side effects.

Is there a way to convert a .DCU into a C++ Builder compatible .OBJ??
>Is there a way to convert a .DCU into a C++ Builder compatible .OBJ??

I don't think so, but I am looking at the files generated from compiling a Delphi component with C++Builder, and an OBJ file is generated.  You might try removing the source PAS file from the path after the component has successfully been compiled into the component library.  This should prevent the debugger from intruding, while still allowing the component to compile.


I tried that yesterday...it did work.  You should post again as
a question and I will award you points.

As an aside...I now have two registration directories.

   Components
      --Registration CBuilder
      --Registration Delphi
      --Sources

When installing the components in CBuilder, CBuilder overwrites (rewrites) the .DCU files, making them incompatible with Delphi.
Delphi complains when you try to install the components after you've installed them with CBuilder.  You may or may not have noticed this.  Therefore it is important to separate  your registration files, as Delphi and CBuilder will do different things to the .DCUs.

Anyhow, all comments will be saved in the database, so simply post a question saying, "See comments above".  I'll give you a B or an A...haven't decided.  But since you were the only one to respond, I'm leaning towards an A.
If yuo don't have the source files in the same location as the .DCUs, like me.  Delphi will try and read the .DCUs as is.  CBuilder rewrites them.  Therefore after an install with CBuilder, the .DCUs are no longer compatible with Delphi.  Thought I'd re-explain, since I think I didn't make myself as clear as I could have above.
ASKER CERTIFIED SOLUTION
Avatar of sleach
sleach

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Adjusted points to 80
I increased the points by 5, so that you'll be on the experts points board.
Thank you.  
I hope you Like CBuilder as much as I think I will.  My first complaint about Delphi was that it used Object Pascal rather than C++, But with CBuilder, we get the best of BOTH worlds.

Steve