Did C++11 address concerns passing std lib objects between dynamic/shared library boundaries? (ie dlls and so)?
Posted
by
Doug T.
on Programmers
See other posts from Programmers
or by Doug T.
Published on 2012-11-21T13:47:59Z
Indexed on
2012/11/21
17:15 UTC
Read the original article
Hit count: 230
One of my major complaints about C++ is how hard in practice it is to pass std library objects outside of dynamic library (ie dll/so) boundaries.
The std library is often header-only. Which is great for doing some awesome optimizations. However, for dll's, they are often built with different compiler settings that may impact the internal structure/code of a std library containers. For example, in MSVC one dll may build with iterator debugging on while another builds with it off. These two dlls may run into issues passing std containers around. If I expose std::string
in my interface, I can't guarantee the code the client is using for std::string
is an exact match of my library's std::string
.
This leads to hard to debug problems, headaches, etc. You either rigidly control the compiler settings in your organization to prevent these issues or you use a simpler C interface that won't have these problems. Or specify to your clients the expected compiler settings they should use (which sucks if another library specifies other compiler settings).
My question is whether or not C++11 tried to do anything to solve these issues?
© Programmers or respective owner