Can I disable Exceptions and RTTI in Boost libraries?

I develop some native libraries for Android and use Boost libraries - only based on headers. The problem I am facing is that when I try to link some of my native libraries to some kind of system library, an UnsatisfiedLinkError is UnsatisfiedLinkError . This is due to different C ++ runtimes, as stated in the NDK documentation:

You can choose only one C ++ runtime environment in which all your code will depend on. It is not possible to combine shared libraries compiled against different C ++ runtimes.

System libraries do not use RTTI and exceptions, but my libraries use it implicitly. I know that there are macros BOOST_EXCEPTION_DISABLE and BOOST_NO_RTTI , but I can not get it to work. I tried to set them as compiler flags and in config.hpp, but with no luck - still getting a lot of errors like

 cannot use typeid with -fno-rtti 

How to disable these features in Boost, is this possible?

+8
c ++ boost android-ndk
source share
1 answer

The answer is "maybe." Some acceleration libraries will work with exceptions disabled - some will not. The same goes for RTTI.

I suggest you check the documentation for the acceleration libraries you are interested in.

For example, Boost.Array will work with exceptions disabled, but Boost.Format will not.

If you receive messages like cannot use typeid with -fno-rtti , this will probably be when compiling some part of Boost that requires RTTI. If an error occurs, it will tell you which library (usually).

+5
source share

All Articles