stdcxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: error LNK2005 : VC8
Date Thu, 04 Jan 2007 17:21:44 GMT
Nadine Faizant wrote:
[...]
> So, in graph lib I have a Class A which inherits of deque that I have declare as
> 
> Class DLLExportGraph : public B, public std::deque<C>

I'll bet this is it. Here's my theory (I'm not quite done moving
and my Windows box isn't back up yet so I haven't confirmed it in
a test case.)

Since you're exporting the derived class, members of the derived
class are part of the DLL ABI. But since the base isn't exported
its members are not. When you import the derived class, you get
the definitions of its members exported from the DLL but you get
new copies of the (non-exported) base members.

What I suspect you need to do in addition to declaring the derived
class exported is do the same for std::deque<C> in graph.{dll,lib}
and the declare them both dllimport-ed when using the library. That
way there will exactly one copy of both the derived and the base
members.

There's plenty of articles on the annoying quirks and limitations
of Windows DLLs in MSDN. Here's one (not the best one but it does
cover your case):
http://msdn2.microsoft.com/en-us/library/twa2aw10.aspx

Martin

Mime
View raw message