Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Header Generation    [ Add a report in this area ]  
Report #:  67783   Status: Closed
C++ typedefs generated from Delphi class aliases are not correct
Project:  C++Builder Build #:  12.0.3170.16989
Version:    12.0 Submitted By:   Clayton Arends
Report Type:  Basic functionality failure Date Reported:  10/10/2008 10:13:24 PM
Severity:    Serious / Highly visible problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   265809
Resolution: Fixed (Resolution Comments) Resolved in Build: : 14.0.3513.24210
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 5
Description
When Delphi code contains an alias the generated HPP file references are incorrectly labeled as pointers to the base type.  Example:

  // Delphi code
  type
    TMyClass = class
    end;

    TMyClassAlias = TMyClass;

  // Generate HPP
  class TTest : public System::TObject ...

  typedef TTest* TMyTest;

Note the erroneous pointer "*" in the typedef.  The typedef should be as follows:

  typedef TTest TMyTest;

In some cases the aliases are required for previous compiler versions since RAD2009 changed the names of some classes and aliased the old names for "backward compatibility".  TZCompressionStream, TZDecompressionStream, and TPNGObject are three examples that have affected me.

Previous compiler versions (RAD2007, BCB6) generate the code correctly.
Steps to Reproduce:
To generate the problem for yourself follow these steps.

- Create a new Delphi or C++Builder personality package
- Edit the project options
- Click on "Delphi Compiler | Linking"
- Set "Linker output" to "Generate all C++Builder files"
- Click "OK"
- Add a new Delphi unit to the project
- Add the following to the interface section
  type
    TMyClass = class
    end;

    TMyClassAlias = TMyClass;

- Save the project and build
- Open the generated HPP file and locate the typedef for TMyClassAlias
- Notice the erroneous pointer in the typedef

There are examples spread throughout the VCL code.  Look in the following VCL files for examples:

  ( pngimage.hpp : line 650 )
  typedef TPngImage* TPNGObject;

  ( ZLib.hpp : line 111 )
  typedef TZCompressionStream* TCompressionStream;

  ( ZLib.hpp : line 134 )
  typedef TZDecompressionStream* TDecompressionStream;
Workarounds
None
Attachment
None
Comments

Clayton Arends at 11/2/2008 7:42:04 AM -
Still a problem in CB2009 Update 1

Remy Lebeau (TeamB) at 12/1/2008 10:23:21 AM -
Confirmed

Clayton Arends at 5/28/2009 10:07:45 AM -
Apparently fixed in 12.0.3420.21218.  Please verify and mark as fixed.

Tomohiro Takahashi at 5/28/2009 8:11:37 PM -
Thanks for the confirmation.

Remy Lebeau (TeamB) at 9/1/2009 3:28:11 PM -
Fixed in CB2010

Server Response from: ETNACODE01