Board index » cppbuilder » Delphi port "undefined symbol" problem

Delphi port "undefined symbol" problem

All,

I recently downloaded and installed the Virtual treeview controls from
http://www.lischke-online.de/.  (Wait!  Don't start screaming that this post
belongs in 'third-party-controls'.  Keep reading!)  These controls are
written for Delphi so I added the main PAS file (VirtualTrees.pas) to a
package and compiled.  It compiles fine as a package but when used in a
project the following error occurs:

    [C++ Error] VirtualTrees.hpp(462): E2451 Undefined symbol 'TCacheEntry'

Now, when I take a look at the HPP file I indeed see TCacheEntry used before
it has been declared:

    // On line 462
    typedef DynamicArray<TCacheEntry >  TCache;

    // Down on line 1206
    struct TCacheEntry
    {
        TVirtualNode *Node;
        unsigned AbsoluteTop;
    };

However, when I look at the Delphi source, TCacheEntry is actually declared
before it is used by the TCache declaration, 2 lines later:

    TCacheEntry = record
        Node: PVirtualNode;
        AbsoluteTop: Cardinal;
    end;

    TCache = array of TCacheEntry;

I thought maybe this would always happen so I created a dummy PAS file with
the same structure.  However, the generated HPP file had the declarations in
the correct order.

I searched Deja.com for anything remotely like this problem and found a
converstaion thread between Joel Broughton and Mark Cashman ("Component
Installation" in borland.public.cppbuilder.vcl.components.using) that ended
on 11/09/2000 without resolution to the problem.  My hypothesis is that
there is a tiny Delphi source conversion problem that is only brought out by
large PAS files with many combinations of const - type - const - type
sections.

If you know how to fix this problem please let me know.  Currently, I am
editting the HPP file and putting the declarations in the appropriate order,
and then moving the PAS file so that recreation of the HPP file doesn't
occur.  Not a long-term solution since time forgets occasionally.

I am running BCB5 Pro Patch #1.  I have a feeling that this doesn't occur
pre patch (so far I have found one other such problem, also dealing with PAS
file useage).

Thanks,

- Clayton

 

Re:Delphi port "undefined symbol" problem


Will this one go answered as well?  My posts seem to "fall through the
cracks" rather easily.   hmmmmm.

Do I post on bad TeamB biorythm dates?

Is this topic too advanced?  silly?

I'm sure somebody else out there has had a similar problem with another PAS
file.  Perhaps since installing the patch?

I'll wait another 4 days.

- Clayton

Re:Delphi port "undefined symbol" problem


Quote
> Will this one go answered as well?  My posts seem to "fall through the
> cracks" rather easily.   hmmmmm.

> Do I post on bad TeamB biorythm dates?
Heh heh... No.

> Is this topic too advanced?  silly?

Might be a little advanced. Maybe people shy away from problems that require
a third party download.

Of course this is not a silly problem.

I've taken some time to look at this problem and it does appear to be some
sort of bug.

I haven't yet been able to create a smaller test case that reproduces the
problem. If you have a smaller test cases that produce this problem, I would
be interested in seeing it.

I've tried moving around declarations in the PAS file in attempt to work
around, but have not been successful. If you're interested, you might
continue along this route.

In any case, thank you for bringing this bug to our attention.

Vincent Drake
Borland Technical Support

Re:Delphi port "undefined symbol" problem


Vincent,

Wow.  Looks like I've leap-frogged TeamB straight to a Borland
developer/techie.  I'm honored.

Quote
> I haven't yet been able to create a smaller test case that reproduces the
> problem. If you have a smaller test cases that produce this problem, I
would
> be interested in seeing it.

I tried moving statements around in the PAS file before posting here the
first time and received the same results as you.  That is why this problem
is bafffling me so much.  The order of declarations is correct in the PAS
file, but reversed (and far far apart from each other) in the HPP file.  I
also had created a smaller test case using a combination of const, type,
const sections which turned out okay in the end as well.

Quote
> In any case, thank you for bringing this bug to our attention.

You're welcome.  I would have submitted a bug report ... but ... well you
know why I couldn't.

And since we're talking about Delphi import bugs, have you ever noticed the
default parameter problem?  If the Delphi source has a default parameter,
the ported HPP function/method declaration will not have the default
parameter specified.  This forces one to either add the correct defaults by
hand to the HPP file or to just suck it up and call the functions with all
parameters.

    // Delphi PAS source (implementation)
    procedure Test(Param1: Integer; Param2: Integer = 12);

    // BCB HPP source
    void __fastcall Test(int Param1, int Param2);    // whoops

Take care,

- Clayton

Re:Delphi port "undefined symbol" problem


Clayton,

I have exactly the same problem importing the Virtual Tree in BCB5.0
Pro.
Have you guys solved the problem ?
If yes, could you send me the corrected hpp file so that I can compile ?

Thanks a lot

Yann

  lyann.vcf
< 1K Download

Re:Delphi port "undefined symbol" problem


Yann,

I sent you the HPP file with further instructions.

Quote
> Have you guys solved the problem ?

Well, the problem has been found but not fixed.  This is a Delphi VCL port
problem within Builder.  The fix is really a work-around.

- Clayton

Other Threads