|
Boost : |
Subject: [boost] [thread] 1.41.0 regression
From: Dmitry Goncharov (dgoncharov_at_[hidden])
Date: 2009-12-15 13:17:07
Hi,
The thread_data_base constructor is defined in a header file. Function
make_external_thread_data() is defined in a .cpp file. This can lead to
a situation when different libraries contain the definitions of these
functions. The example below explains how this can happen and why this
causes problems.
The new version of struct thread_data_base contains an std::map member.
The size of an std::map object depends on if libboost_thread.so was
build with or w/o _GLIBCXX_DEBUG.
libboost_thread.so contains make_external_thread_data(). This function
allocates an instance of thread_data_base. Due to an std::map member the
size of the allocated object depends on _GLIBCXX_DEBUG.
There is a library (e.g. libuser.so) which uses the Boost.Thread
library. Since the thread_data_base constructor is defined in a header
file libuser.so can contain its definition.
Again, the size of thread_data_base object, that the thread_data_base
constructor from libuser.so expects, depends on if libuser.so was built
with _GLIBCXX_DEBUG defined or not.
An application cannot link agains both libboost_thread.so and libuser.so
if these libraries were built with different _GLIBCXX_DEBUG definitions
(or different alignment, etc).
While loading the application the dynamic linker will use the definition
of thread_data_base constructor either from libuser.so be or from
libboost_thread.so. Whichever it finds first.
Can both the thread_data_base constructor and
make_external_thread_data() reside either in a .cpp file or in a header?
BR, Dmitry
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk