[PATCH] dynamic_cast and gcc3

Malte Starostik malte at kde.org
Tue Nov 19 22:27:37 GMT 2002


On Tuesday 19 November 2002 15:57, Simon Hausmann wrote:
> How about adding a default implementation for one of those pure
> virtual methods and compile them into a shared library (isn't there
> already some kview library that all plugins link against?) . I think
> that should convince gcc to emit the type info as well and cause
> everyone to share the same type info symbols at run-time (making the
> use of d-cast safe) .
Nope. The type info is available as soon as any virtual is implemented (which 
is done by providing a virtual dtor). The problem is that as opposed to older 
gcc versions, 3.x uses the type info's address and not its name() for the 
equality operator which is used by dynamic_cast.
But since both the main program and the plugin library provide the type info, 
the addresses won't compare equal.
The dynamic_cast should work fine if kview (not the plugins) is compiled with 
-Wl,-E on gcc 3.x setups.
-Malte
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20021119/b891ef62/attachment.sig>


More information about the kde-core-devel mailing list