Re: Virtual destructors and vtable layout
On Oct 15, 7:44 am, Stephen Horne <sh006d3...@blueyonder.co.uk> wrote:
On Fri, 10 Oct 2008 13:42:57 -0700 (PDT), James Kanze
<james.ka...@gmail.com> wrote:
On Oct 10, 5:21 pm, "Ole Nielsby"
<ole.niel...@tekareyouspamminglogisk.dk> wrote:
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.
Why wouldn't you call them across .DLL borders. We have code
in places that would require it, and it's never caused any
problems. Across numerous versions of Solaris and Linux, and
some versions of Windows.
There are issues with some compilers, but probably only old
ones. I remember problems with Borland C++ 5.02. Each DLL
ended up with a different heap. It's possible that linker
options or similar were to blame, but the easiest thing at the
time was to ensure that data always got deleted by the same
DLL that newed it - usually not a big deal.
Not something I was particularly involved in - just a rule I
had to work with at the time.
That has nothing to do with COM, but is related to the way
dynamic linking works under Windows and some poorly choosen
defaults in the linker. From what I understand, the problem is
that the library which contains malloc/free is linked
statically by default, in each dynamic object. And that it is
sufficient to use the dynamically linked version of this library
to avoid the problem.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34