Have you ever encountered one such dreaded warning messages ( warning C4251 ):
D:\Microsoft Visual Studio .NET 2003\Vc7\include\list(93) : warning C4251: ’std::_List_nod<_Ty,_Alloc>::_Alnod’ : class ’std::allocator<_Ty>’ needs to have dll-interface to be used by clients of class ’std::_List_nod<_Ty,_Alloc>’
with
[
_Ty=Magick::Coordinate,
_Alloc=std::allocator<Magick::Coordinate>
]
and
[
_Ty=std::_List_nod<Magick::Coordinate,std::allocator<Magick::Coordinate>>::_Node
]
and
[
_Ty=Magick::Coordinate,
_Alloc=std::allocator<Magick::Coordinate>
]
And did you ever wonder what caused it or perhaps how to solve this warning problem. Honestly, I still could not figure out the right workaround with STL containers but found this Microsoft Link useful.
Happy Coding.
Z.
very interesting, but I don’t agree with you
Idetrorce
Comment by Idetrorce — December 16, 2007 @ 12:16 am |
It illustrates a grave, known incompatibility between STL and dynamic libraries.
DLL is binary. But STL generates methods lazily, only when they are used.
Thus, when you link a DLL, STL doesn’t generate any of the functions a client program will need.
Furthermore, STL is deeply layered, with base classes and base-base classes, and so on.
So you can not force STL to generate the methods required for shared binaries. There are too many, and they are too fine-grained.
Deep, hideous compiler changes are necessary.
Comment by wayne isaacs — January 24, 2009 @ 6:06 am |