File indexing completed on 2025-01-18 09:30:44
0001
0002
0003
0004
0005
0006
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 }}}
0053
0054 #endif
0055