[Interest] QPlugin and RTTI

Till Oliver Knoll till.oliver.knoll at gmail.com
Mon Jun 23 12:08:05 CEST 2014


Am 23.06.2014 um 03:11 schrieb Thiago Macieira <thiago.macieira at intel.com>:

> ... In QObject and qobject_cast's case, it's the 
> meta object (the output of moc); for RTTI and dynamic cast, it's the typeinfo. 
> Each must exist in a single library.

Not sure whether I fully understand your "[runtime info] must exist in a single library" requirement here, but I always thought that the advantage of using the "Qt Meta System" over the RTTI was that the former would work "across library boundaries", whereas the later not (guaranteed, since compiler-specific).

Or in other words: you can implement an object  Foo (derived from QObject which is yet in another library - sic!) in one library foo.dll (or libfoo.so), derive another object Bar from Foo in another library bar.dll, and do an qobject_cast in yet another barfoo.dll library on a given instance of either QObject, Foo or Bar and get the proper result.

Whereas with RTTI that is not guaranteed to work across compilers (maybe with today's recent compilers it does).

No?

Cheers,
  Oliver


More information about the Interest mailing list