Z’s

December 6, 2007

Exporting STL member variables in a DLL (C/C++)

Filed under: C/C++ — mdzahidh @ 9:35 am

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.

Advertisements

Blog at WordPress.com.