O
Ole Nielsby
Component models like COM, UNO, XPCOM etc. rely on
the vtable layout being the same across compilers.
I wonder what happens if virtual destructors are used.
I realise I shouldn't call virtual destructors across dll borders,
but it would be nice to be able to use them internally in
components, still.
My guess is, most compilers will deal with virtual destructors
like any other virtual functions, allocating vtable positions in
the order of declaration.
But then again, some compilers might use more than one
vtable slot, or allocate the virtual destructor at a fixed
negative offset for uniform treatment, or what do I know.
I know vtable-layout isn't officially standardised but without
de facto-standards for vtable layout, these component models
would be hard to deal with. So I wonder if virtual destructors
are dealt with in a de facto standard way, or will they break
the component models if used?
(Why I want to know: I'm trying to design a lightweight
component model for in-proc dll addins and I'd like to
have a virtual destructor in the object base class - but
not if it makes the vtable layout compiler dependent.)
the vtable layout being the same across compilers.
I wonder what happens if virtual destructors are used.
I realise I shouldn't call virtual destructors across dll borders,
but it would be nice to be able to use them internally in
components, still.
My guess is, most compilers will deal with virtual destructors
like any other virtual functions, allocating vtable positions in
the order of declaration.
But then again, some compilers might use more than one
vtable slot, or allocate the virtual destructor at a fixed
negative offset for uniform treatment, or what do I know.
I know vtable-layout isn't officially standardised but without
de facto-standards for vtable layout, these component models
would be hard to deal with. So I wonder if virtual destructors
are dealt with in a de facto standard way, or will they break
the component models if used?
(Why I want to know: I'm trying to design a lightweight
component model for in-proc dll addins and I'd like to
have a virtual destructor in the object base class - but
not if it makes the vtable layout compiler dependent.)