Methodes of interest

Simon Hausmann hausmann at kde.org
Mon May 27 11:02:04 UTC 2002


On Mon, May 27, 2002 at 11:05:58AM +0200, Bernd Gehrmann wrote:
> On Monday 27 May 2002 09:49, you wrote:
> > On Sun, May 26, 2002 at 06:35:57PM +0200, Christoph Cullmann wrote:
> 
> > BTW, KParts::ComponentFactory provides pretty much the same, in a
> > generic fashion :)
> 
> I'm confused. Wasn't dynamic_cast over an application-plugin border said
> to not work in general? But KParts::ComponentFactory uses dynamic_cast.
> As it's a template class, the compiler emits the code in the application,
> and the object it works on is an instance of a class defined in the plugin.

dynamic_cast does not work across shared libraries, unless they are
opened with RTLD_GLOBAL or the rtti symbols can be resolved through
a shared intermediate library. 

There are essentially two d-casts in the template, one for
KParts::Factory and one for the template argument. The cast for
KParts::Factory succeeds as the rtti symbols are resolved from
libkparts.so. The d-cast for T succeeds as the rtti symbols from
libktexteditor are used.


Simon




More information about the KDevelop-devel mailing list