Board index » cppbuilder » BCB 3: Bug - wrong header for Pascal typedef

BCB 3: Bug - wrong header for Pascal typedef

Hi,

BCB 3.0(1) / DCC32 (VER110) is not able to create a usable HPP for
this type declaration:

unit Unit2; interface

type
  MyString = ShortString;

implementation end.

The result you will get looks is (lines of no interest left out):

namespace Unit2
{
//-- type declarations
-------------------------------------------------------
typedef typedef ShortString MyString;
;

... and, of course, the C++ part will complain.

If anybody is able to confirm this here, I will report that as a bug
through the web-based form. Anybody with experience re: DCC32
(VER120)?

Does this problem _also_ exist in BCB _1_?

This has also further reaching implications on source-level debugging;
if I apply the (disgusting, completely undocumented) work-around as
found below, then there will be a line/code mismatch for debugging:

Example:

procedure TEmail.CheckMAPI;
{$IFDEF RESSTRING}
resourcestring
{$ELSE}
const
{$ENDIF RESSTRING}
  SNoMapi = 'MAPI services are not available on this system';
begin
  if not MAPIavailable then { call function in SMAPI.PAS }
    raise EMAPIunavailable.Create(SNoMapi);
end;

The exception is raised on the {$IFDEF} line, not where it really
orginates. How can I fix that?

Now, since this is not an artificial problem, but a real one (these
are 16/32 bit compatibility type redefinitions in a component), I am
looking for a _real_ work-around.

Apparently (from the VCL source code), I can "comment out" this
complete mess for BCB 3.0 ($IFDEF BCB) and just emit my own typedef
($HPPEMIT) and get rid of the Pascal declaration ($NODEFINE). It
appears to work...

There is just one problem: does BCB _1_ support all these directives?
This code is expected to work with all of Delphi 1-4, BCB 1/3, and
later versions of any of these compilers - from a single source.

PS: Why is there no documentation for these directives?

--
Stefan.Hoffmeister (at) Uni-Passau.de
http://kakadu.rz.uni-passau.de/~w4hoff01/
   DIR: Delphi FAQs, KBs, docs

Private email regarding Delphi will usually be ignored
unless it has been expressedly invited.

 

Re:BCB 3: Bug - wrong header for Pascal typedef


Same error with DCC32 ver 12

Jeff Overcash

Other Threads