Removing RTTI from Boost::Interprocess
I'm trying to use Boost::Interprocess for shared memory. However, my program also requires the use of LLVM, and LLVM requires fno-rtti, while Boost::Interprocess requires RTTI. Specifically, I tried the first example here, and I got compilation errors:
/usr/include/boost/interprocess/detail/in_place_interface.hpp:50:71: error: cannot use typeid with -fno-rtti : in_place_interface(::boost::alignment_of::value, sizeof(T), typeid(T).name())
My solution to this was to browse through the Boost::Interprocess headers and replace each typeid().name()
with the string constant "sometype"
. The example now compiles and runs fine (as far as I can tell). My poorly-understood impression is that Boost::Interprocess uses typenames to index a map, as an optimization to speedup lookups. Under my poorly-understood impression, changing all typenames to be constant will give a performance penalty, but won't impact correctness.
If I don't remove RTTI from Boost::Interprocess, I will be forced to use some other interprocess library, because this page doesn't give me a lot of hope for mixing RTTI and no-RTTI.
Is this replacement, of nuking RTTI in the Boost::Interprocess headers by replacing typeid
with constant strings, ok? I'm worried about incorrect behavior, such as Boost using the typeid to determine which destructor to call, or other such issues. I'm on a single-developer, single-purpose virtual machine.