1 // Copyright 2014 Renato Tegon Forti, Antony Polukhin.
2 // Copyright 2015-2019 Antony Polukhin.
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt
6 // or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef BOOST_DLL_SYSTEM_ERROR_HPP
9 #define BOOST_DLL_SYSTEM_ERROR_HPP
11 #include <boost/dll/config.hpp>
12 #include <boost/predef/os.h>
13 #include <boost/throw_exception.hpp>
19 #ifdef BOOST_HAS_PRAGMA_ONCE
23 namespace boost { namespace dll { namespace detail {
25 inline void reset_dlerror() BOOST_NOEXCEPT {
27 const char* const error_txt = dlerror();
32 inline void report_error(const boost::dll::fs::error_code& ec, const char* message) {
34 const char* const error_txt = dlerror();
36 boost::throw_exception(
37 boost::dll::fs::system_error(
39 message + std::string(" (dlerror system message: ") + error_txt + std::string(")")
45 boost::throw_exception(
46 boost::dll::fs::system_error(
52 }}} // boost::dll::detail
54 #endif // BOOST_DLL_SYSTEM_ERROR_HPP