Re: Assistance required, exporting a class from a DLL
On Tue, 9 Sep 2008 16:46:22 +0300, "Alex Blekhman" <tkfx.REMOVE@yahoo.com>
2. I know that I exported a class derived from
std::pair<unsigned,unsigned> from a library, and the compiler
actually exported not only symbols of the derived class but also
symbols of the baseclass. I personally consider that a bug, and
I believe it also isn't present in all MS compilers [...].
Why do you think it is a bug? Suppose client creates an instance
of the exported object. Now compiler must be able to call its
constructor, check availability and visibility of base class
FWIW, I think it's a misfeature. It's not necessary because templates can
be instantiated wherever they're used, which I believe Ulrich mentioned.
Sure, you get some code duplication, but it's not much different than using
inline functions, and since you're treating this as equivalent to static
linking anyway WRT compiler settings (You are, right?), it doesn't really
solve any problems that I can see. You might think it solves the template
static data problem, but different modules will still have their own
instances of template static data under this automatic exporting, so I
don't think so. I'm really not sure what the point of this was. It
definitely did not occur in VC6, and IIRC, it was added in VS.NET 2003.
Visual C++ MVP