|
Boost Users : |
From: Russell Hind (yg-boost-users_at_[hidden])
Date: 2003-03-03 05:57:25
I have built the boost::signals library with C++Builder 6 Pro Update 4
and am running into problems:
a) We tend to use double word alignment, not quad word (which is the
default in C++Builder). It appears that the libraries are built with
quad word, but the headers don't enforce this, so when I change the
options to double word (in our project) and try to construct a signal with
boost::signal0<void> s;
I get an access violation when constructing a signal (from line 266 of
shared_count.hpp) The call stack is
00417F3F __internal_malloc
00417DD8 __internal_malloc
00417539 ___org_malloc
00416EA2 ___org_new
004076E1 boost::detail::shared_count::shared_count(this=:0012FBB4,
p=:007F3928, d={ }, =:007F3928)
004063E3
boost::shared_ptr<boost::signals::detail::signal_base_impl>::shared_ptr<boost::signals::detail::signal_base_impl>(this=:0012FBB0,
p=:007F3928)
0040546D
boost::shared_ptr<boost::signals::detail::signal_base_impl>::reset<boost::signals::detail::signal_base_impl>(this=:0012FF70,
p=:007F3928)
00403F51
boost::signals::detail::signal_base::signal_base(this=:0012FF70,
comp=:0012FC24)
0040232E boost::signal0<void, boost::last_value<void>, int,
_STL::less<int>, boost::function0<void, boost::empty_function_policy,
boost::empty_function_mixin, _STL::allocator<boost::function_base> >
>::signal0<void, boost::last_value<void>, int, _STL::less<int>,
boost::function0<void, boost::empty_function_policy,
boost::empty_function_mixin, _STL::allocator<boost::function_base> >
>(this=:0012FF70, c=:0012FC7C, comp=:0012FC74)
00401BF3 main(argc=1, argv=:007F21E4)
00420862 __startup
b) If I do use quad word alignment, then the object constructs
correctly, but when I connect a method to it with
void VoidFunc(void)
{
}
int main(int argc, char* argv[])
{
boost::signal0<void> s;
s.connect(&VoidFunc);
}
the program hangs. Turning on CodeGuard shows a similar problem to that
above. The object was allocated with a size of 12 bytes, but code is
trying to access byte 16 in the object (I guess this is a similar
alignment problem). The callstack is
0041E44E boost::counted_base::dispose(this=:00C04360)
00427203 boost::signals::detail::signal_base_impl::connect_slot
00404741 boost::signal0<void, boost::last_value<void>, int,
_STL::less<int>, boost::function0<void, boost::empty_function_policy,
boost::empty_function_mixin, _STL::allocator<boost::function_base> >
>::connect(this=:0012FF60, in_slot=:0012FDA8)
004026C5 main(argc=1, argv=:00C021E4)
00433802 __startup
It says the this pointer block is only 12 bytes long, but the code is
trying to access byte 16.
Do (or should) all the bost headers force alignment before all
structures/classes and then restore the alignment afterwards?
Currently, I have to link directly with the signals source code to get
use the library.
Has anything to do with this been changed in the builds of 1.30.0?
Thanks
Russell
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net