Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:44

0001 // Copyright 2014 Renato Tegon Forti, Antony Polukhin.
0002 // Copyright Antony Polukhin, 2015-2023.
0003 //
0004 // Distributed under the Boost Software License, Version 1.0.
0005 // (See accompanying file LICENSE_1_0.txt
0006 // or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 
0008 #ifndef BOOST_DLL_SYSTEM_ERROR_HPP
0009 #define BOOST_DLL_SYSTEM_ERROR_HPP
0010 
0011 #include <boost/dll/config.hpp>
0012 #include <boost/predef/os.h>
0013 #include <boost/throw_exception.hpp>
0014 
0015 #if !BOOST_OS_WINDOWS
0016 #   include <dlfcn.h>
0017 #endif
0018 
0019 #ifdef BOOST_HAS_PRAGMA_ONCE
0020 #   pragma once
0021 #endif
0022 
0023 namespace boost { namespace dll { namespace detail {
0024 
0025     inline void reset_dlerror() BOOST_NOEXCEPT {
0026 #if !BOOST_OS_WINDOWS
0027         const char* const error_txt = dlerror();
0028         (void)error_txt;
0029 #endif
0030     }
0031 
0032     inline void report_error(const boost::dll::fs::error_code& ec, const char* message) {
0033 #if !BOOST_OS_WINDOWS
0034         const char* const error_txt = dlerror();
0035         if (error_txt) {
0036             boost::throw_exception(
0037                 boost::dll::fs::system_error(
0038                     ec,
0039                     message + std::string(" (dlerror system message: ") + error_txt + std::string(")")
0040                 )
0041             );
0042         }
0043 #endif
0044 
0045         boost::throw_exception(
0046             boost::dll::fs::system_error(
0047                 ec, message
0048             )
0049         );
0050     }
0051 
0052 }}} // boost::dll::detail
0053 
0054 #endif // BOOST_DLL_SYSTEM_ERROR_HPP
0055