Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delphi components in C++ Builder 6

Status
Not open for further replies.

Sajo4242

Programmer
Mar 15, 2006
3
SK
Hi,

I have some .dcu files and I need to compile it in Borland C++ Builder 6. It works in Delphi 7. I have use Delphi Decompiler to extract .pas units from .dcu files. I tried many roads to compile it but it's no use. Someone please help me. The dcus are on this link
Thanks
 
The following comes from C++Builder Developer's Journal, August 2001 by Kent Reisdorph. I haven't tried these but they might get you started. He give three possible solutions

Using_Units_Directly said:
Often you will find Delphi example projects that contain a unit that you want to use in your applications. The simplest way of using a Delphi unit is to simply add it to your project. Here are the steps to take to add a Delphi unit to a C++Builder project:

1. Create your C++Builder project.

2. Select Add to Project from the C++Builder toolbar or menu.

3. Select "Pascal unit" from the Files of Type combo box on the Open dialog box.

4. Select a Delphi unit to add to your project and click OK.

5. Build the application before writing any code that references the Delphi unit. This builds the Delphi unit and creates a header you can include in your application.

6. Choose File | Include Unit Hdr… from the C++Builder main menu and add the Delphi form to your application.

7. Write code that references the Delphi unit.

When you build the application, C++Builder uses its built-in Pascal compiler to create an OBJ that the application can use. The Pascal compiler also generates a header from the Pascal source. Using Delphi units this way is very easy.

Converting_Code said:
Even without knowing Pascal you can probably manage to convert this unit manually. However, you can get a head start by using C++Builder’s Pascal compiler to create a header for this unit. You could add the unit to your C++Builder application and compile, but you can also use the command line compiler. Here are the steps:

1. Open a command prompt box and navigate to the folder containing the Delphi unit.

2. At the command prompt, type the following:

dcc32 -jphn TestUnit.pas

DCC32.EXE is the Pascal compiler. The -jphn switch tells the Pascal compiler to create a header and an OBJ file compatible with C++Builder. When this command executes, the file is compiled and a header and OBJ are created (the OBJ is not really significant in this case since you won’t be using it anyway).

Dcc32.exe is included in BCB. :)

Using_Delphi_Components said:
There are many example, shareware, and freeware components available for Delphi. In most cases, the author does not include a C++Builder equivalent. Components including Delphi source code can typically be used with little or no modification. The steps to use a Delphi component are:

1. Create a new package for the component. Typically you will create a package that is both a run-time and a design package.

2. Add the Delphi source code for the component to the package.

3. Build the package and install it.

Granted, this process is simple, but many C++Builder programmers don’t realize that Delphi components can be used in this way.

James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Concerning the last post...does it matter if the components is for different version of Delphi...I mean if I have BCB6...what should the delphi version of teh component the Iam going to download be
 
Don't know. You may have to try one or more of the above ideas to find out.


James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
I have tried all three alternatives. There are always some errors in source codes. But in Delphi the compilation proceed correctly. I don't know what to do.
 
What are the errors?


James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Identifier redeclared
Undeclared identifier
Identifier expected but 'FINALIZATION' found
Statement expected but 'PROCEDURE' found
; expected
Unsatisfied forward or external declaration

and so...
 
The first says that there is an identifier declared somewhere and then redeclared. Possible something already declared in BCB that may not be in Delphi. The other lines may be related since the compiler is confused at this point. Can you track down the lines where the errors occur?


James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top