1 // Copyright 2014 Renato Tegon Forti, Antony Polukhin.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt
5 // or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #ifndef BOOST_DLL_SYSTEM_ERROR_HPP
8 #define BOOST_DLL_SYSTEM_ERROR_HPP
10 #include <boost/config.hpp>
11 #include <boost/predef/os.h>
12 #include <boost/system/error_code.hpp>
13 #include <boost/system/system_error.hpp>
14 #include <boost/throw_exception.hpp>
20 #ifdef BOOST_HAS_PRAGMA_ONCE
24 namespace boost { namespace dll { namespace detail {
26 inline void reset_dlerror() BOOST_NOEXCEPT {
28 const char* const error_txt = dlerror();
33 inline void report_error(const boost::system::error_code& ec, const char* message) {
35 const char* const error_txt = dlerror();
37 boost::throw_exception(
38 boost::system::system_error(
40 message + std::string(" (dlerror system message: ") + error_txt + std::string(")")
46 boost::throw_exception(
47 boost::system::system_error(
53 }}} // boost::dll::detail
55 #endif // BOOST_DLL_SYSTEM_ERROR_HPP