12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #ifndef BOOST_DLL_SYSTEM_ERROR_HPP
- #define BOOST_DLL_SYSTEM_ERROR_HPP
- #include <boost/dll/config.hpp>
- #include <boost/predef/os.h>
- #include <boost/throw_exception.hpp>
- #if !BOOST_OS_WINDOWS
- # include <dlfcn.h>
- #endif
- #ifdef BOOST_HAS_PRAGMA_ONCE
- # pragma once
- #endif
- namespace boost { namespace dll { namespace detail {
- inline void reset_dlerror() BOOST_NOEXCEPT {
- #if !BOOST_OS_WINDOWS
- const char* const error_txt = dlerror();
- (void)error_txt;
- #endif
- }
- inline void report_error(const boost::dll::fs::error_code& ec, const char* message) {
- #if !BOOST_OS_WINDOWS
- const char* const error_txt = dlerror();
- if (error_txt) {
- boost::throw_exception(
- boost::dll::fs::system_error(
- ec,
- message + std::string(" (dlerror system message: ") + error_txt + std::string(")")
- )
- );
- }
- #endif
- boost::throw_exception(
- boost::dll::fs::system_error(
- ec, message
- )
- );
- }
- }}}
- #endif
|