
On a 64-bit build on MSVC 8 (CL 14.00.50727.762 for x64) with Boost CVS 2007-06-03, building a program that uses Boost.Interprocess fails. Please see the attachment at the end of the message for the compiler output. The problem is in rbtree_best_fit::SizeHolder:
unsigned m_prev_size : sizeof(std::size_t)*CHAR_BIT - 1;
'unsigned' which is 32-bit is not large enough to hold a 64-bit size_t. If I change 'unsigned' to 'std::size_t' compile is successful without any other errors. When linking, I get: aaron.obj : error LNK2019: unresolved external symbol __imp_InterlockedCompareExchange referenced in function "long __cdecl boost::interprocess::winapi::interlocked_compare_exchange(long volatile *,long,long)" (?interlocked_compare_exchange@winapi@interprocess@boost@@YAJPECJJJ@Z) I was able to fix this by using BOOST_INTERLOCKED_COMPARE_EXCHANGE instead of InterlockedCompareExchange in winapi::interlocked_compare_exchange() in w32_api.h. I had to make a similar translation for InterlockedExchange. With these changes, it appears to compile and link. I can't guarantee yet that it actually works, though. 1>include\boost/interprocess/mem_algo/rbtree_best_fit.hpp(83) : error C2034: 'boost::interprocess::rbtree_best_fit<MutexFamily,VoidPointer>::SizeHolder::m_prev_size' : type of bit field too small for number of bits 1> include\boost/interprocess/mem_algo/rbtree_best_fit.hpp(80) : see reference to class template instantiation 'boost::interprocess::rbtree_best_fit<MutexFamily,VoidPointer>::SizeHolder' being compiled 1> include\boost/interprocess/mem_algo/rbtree_best_fit.hpp(282) : see reference to class template instantiation 'boost::interprocess::rbtree_best_fit<MutexFamily,VoidPointer>' being compiled 1>include\boost/interprocess/mem_algo/rbtree_best_fit.hpp(85) : error C2034: 'boost::interprocess::rbtree_best_fit<MutexFamily,VoidPointer>::SizeHolder::m_size' : type of bit field too small for number of bits 1>include\boost/interprocess/mem_algo/rbtree_best_fit.hpp(83) : error C2034: 'boost::interprocess::rbtree_best_fit<MutexFamily>::SizeHolder::m_prev_size' : type of bit field too small for number of bits 1> with 1> [ 1> MutexFamily=boost::interprocess::mutex_family 1> ] 1> include\boost/interprocess/mem_algo/rbtree_best_fit.hpp(91) : see reference to class template instantiation 'boost::interprocess::rbtree_best_fit<MutexFamily>::SizeHolder' being compiled 1> with 1> [ 1> MutexFamily=boost::interprocess::mutex_family 1> ] 1> include\boost/interprocess/mem_algo/rbtree_best_fit.hpp(269) : see reference to class template instantiation 'boost::interprocess::rbtree_best_fit<MutexFamily>::block_ctrl' being compiled 1> with 1> [ 1> MutexFamily=boost::interprocess::mutex_family 1> ] 1> include\boost/interprocess/detail/managed_memory_impl.hpp(87) : see reference to class template instantiation 'boost::interprocess::rbtree_best_fit<MutexFamily>' being compiled 1> with 1> [ 1> MutexFamily=boost::interprocess::mutex_family 1> ] 1> include\boost/interprocess/managed_windows_shared_memory.hpp(54) : see reference to class template instantiation 'boost::interprocess::detail::basic_managed_memory_impl<CharType,MemoryAlgorithm,IndexType>' being compiled 1> with 1> [ 1> CharType=char, 1> MemoryAlgorithm=boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, 1> IndexType=boost::interprocess::iset_index 1> ] 1> aaron.hpp(85) : see reference to class template instantiation 'boost::interprocess::basic_managed_windows_shared_memory<CharType,AllocationAlgorithm,IndexType>' being compiled 1> with 1> [ 1> CharType=char, 1> AllocationAlgorithm=boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, 1> IndexType=boost::interprocess::iset_index 1> ] 1>include\boost/interprocess/mem_algo/rbtree_best_fit.hpp(85) : error C2034: 'boost::interprocess::rbtree_best_fit<MutexFamily>::SizeHolder::m_size' : type of bit field too small for number of bits 1> with 1> [ 1> MutexFamily=boost::interprocess::mutex_family 1> ]