🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2589

Re: dynamic_cast does not work in packages

#2589
From: Remy Lebeau (TeamB)
Date: Thu, 01 Feb 2007 18:36
22 lines
1688 bytes
"Dmitry" <dmitry@pikalevo.com> wrote in message
news:45c1f643@newsgroups.borland.com...

> I've move some working code from exe to bpl, and now
> dynamic_cast does not work in bpl.

Yes, it does.  Just not the way you think it does.

> meaning it always return NULL
> what can be a problem

You are not taking into account that the RTTI inside a package is
different than the RTTI inside the application or other packages.  You
can't allocate an object in a package, pass it to the application (or
another package), and then test the type of the object using a type
that is declared in a different module.  In order for dynamic_cast to
work, it has to be called in the same module that declares and
allocates the object type being tested.


Gambit
Technical Details
Message-ID: <45c2330e$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <45c1f643@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,eea25a98edb328b5
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <45c1f643@newsgroups.borland.com>
Subject: Re: dynamic_cast does not work in packages
Date: Thu, 1 Feb 2007 10:36:28 -0800
Lines: 24
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 75.83.34.171
Message-ID: <45c2330e$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1170354958 75.83.34.171 (1 Feb 2007 10:35:58 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail