Hi all,
I'm having trouble when trying to reuse some functions that use Boost::Exception into my LLVM-based application. As far as I know, LLVM turns off Exception handling (apparently for performance reasons), so I get the following link-time error in a few places:
"undefined reference to `boost::throw_exception(std::exception const&)"
When I compile the external code from outside the LLVM Makefile system, everything goes well. Is it possible to enable exception handling for some parts of the compilation? Just like turning on RTTI with "REQUIRES_RTTI=1" ? Removing exception handling from the functions is not an option, since I would have to tweak the Boost library internals.
Thanks ahead!
Whatever the LLVM side of things, boost::throw_exception is a function that you, the user, have to implement when disabling exceptions. It's basically the "I want to throw an exception, so what should I really do?" callback.
Sebastian
That's right, I wrote a throw_exception() function with the sole purpose of avoiding error messages. However, I'm not really an expert on exception handling: the function just prints out an error message. boost::throw_exception allows handling exceptions just as when using the C++ builtin "throw" features. The selection of either method is done by defining BOOST_NO_EXCEPTIONS. I'd like to use the standard exceptions instead of making my own. Do you think that's possible? Is it possible (and correct) to turn on exception handling with LLVM?
You can certainly recompile LLVM with exceptions enabled, and I believe
people do. That said, LLVM is not written to be exception-safe, and we're
not likely to accept any exception-safety patches unless they're pretty
minimal, so even if you compile LLVM with exceptions on, I would strongly
suggest never throwing through any LLVM frames.
John.