[Libreoffice] cppu::OPropertySetHelper ABI backwards compatibility

Eike Rathke ooo at erack.de
Mon Aug 22 11:52:58 PDT 2011


Hi Lionel,

On Sunday, 2011-08-21 01:54:17 +0200, Lionel Elie Mamane wrote:

> >From the second (later) commit log message, you intended to preserve
> ABI, but I get the impressions ABI backwards compatibility is still
> broken in a different way by the addition of
> 
>     virtual void SAL_CALL enableChangeListenerNotification( sal_Bool bEnable )
>         throw(::com::sun::star::uno::RuntimeException);
> 
> >From what I observe, at least with GNU GCC/g++ on Debian GNU/Linux
> amd64 (I wouldn't know about MSVC++ and g++ on MS Windows, but
> possibly it is the same), it seems all the virtual functions that are
> declared *after* that one in the header are shifted one position in
> the virtual function table, and that lookups in the virtual function
> table are by position, not by name/signature.

That's just normal behavior, inserting a virtual function shifts all
following functions in the vtable, so code compiled against the old
header calling into the new library calls a function by offset -1, and
code compiled against the new header calling into the old library calls
a function by offset +1.

This is why API marked as published shall not be changed after a release
and you see all the XName2 derived from XName and so on.

> So I'm not sure what to do... Maybe put OPropertySetHelper back like
> it was, and have:
> 
> 
> class OPropertySetHelper2 : public OPropertySetHelper
> {
> public:
> (...)
>     virtual void SAL_CALL enableChangeListenerNotification( sal_Bool bEnable )
>         throw(::com::sun::star::uno::RuntimeException);
> }
> 
> So that new code that wants to have the ability to enable/disable
> change listener notifications can derive from OPropertySetHelper2
> instead, but old code still works?

Yes.

  Eike

-- 
 PGP/OpenPGP/GnuPG encrypted mail preferred in all private communication.
 Key ID: 0x293C05FD - 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110822/eacd9b17/attachment.pgp>


More information about the LibreOffice mailing list