update boost
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Copyright 2014-2015 Renato Tegon Forti, Antony Polukhin.
|
||||
// Copyright 2016-2019 Antony Polukhin.
|
||||
// Copyright Antony Polukhin, 2016-2023.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
@@ -35,8 +35,8 @@ namespace boost { namespace dll { namespace detail {
|
||||
|
||||
// Iterate through all images currently in memory
|
||||
// https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/dyld.3.html
|
||||
const std::size_t count = _dyld_image_count(); // not thread safe: other thread my [un]load images
|
||||
for (std::size_t i = 0; i <= count; ++i) {
|
||||
const uint32_t count = _dyld_image_count(); // not thread safe: other thread my [un]load images
|
||||
for (uint32_t i = 0; i <= count; ++i) {
|
||||
// on last iteration `i` is equal to `count` which is out of range, so `_dyld_get_image_name`
|
||||
// will return NULL. `dlopen(NULL, RTLD_LAZY)` call will open the current executable.
|
||||
const char* image_name = _dyld_get_image_name(i);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2014 Renato Tegon Forti, Antony Polukhin.
|
||||
// Copyright 2015-2019 Antony Polukhin.
|
||||
// Copyright Antony Polukhin, 2015-2023.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2014 Renato Tegon Forti, Antony Polukhin.
|
||||
// Copyright 2015-2019 Antony Polukhin.
|
||||
// Copyright Antony Polukhin, 2015-2023.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
@@ -62,15 +62,16 @@ public:
|
||||
static boost::dll::fs::path decorate(const boost::dll::fs::path & sl) {
|
||||
boost::dll::fs::path actual_path = (
|
||||
std::strncmp(sl.filename().string().c_str(), "lib", 3)
|
||||
? boost::dll::fs::path((sl.has_parent_path() ? sl.parent_path() / L"lib" : L"lib").native() + sl.filename().native())
|
||||
? boost::dll::fs::path((sl.has_parent_path() ? sl.parent_path() / "lib" : "lib").native() + sl.filename().native())
|
||||
: sl
|
||||
);
|
||||
actual_path += suffix();
|
||||
return actual_path;
|
||||
}
|
||||
|
||||
void load(boost::dll::fs::path sl, load_mode::type mode, boost::dll::fs::error_code &ec) {
|
||||
void load(boost::dll::fs::path sl, load_mode::type portable_mode, boost::dll::fs::error_code &ec) {
|
||||
typedef int native_mode_t;
|
||||
native_mode_t native_mode = static_cast<native_mode_t>(portable_mode);
|
||||
unload();
|
||||
|
||||
// Do not allow opening NULL paths. User must use program_location() instead
|
||||
@@ -84,20 +85,20 @@ public:
|
||||
}
|
||||
|
||||
// Fixing modes
|
||||
if (!(mode & load_mode::rtld_now)) {
|
||||
mode |= load_mode::rtld_lazy;
|
||||
if (!(native_mode & load_mode::rtld_now)) {
|
||||
native_mode |= load_mode::rtld_lazy;
|
||||
}
|
||||
|
||||
if (!(mode & load_mode::rtld_global)) {
|
||||
mode |= load_mode::rtld_local;
|
||||
if (!(native_mode & load_mode::rtld_global)) {
|
||||
native_mode |= load_mode::rtld_local;
|
||||
}
|
||||
|
||||
#if BOOST_OS_LINUX || BOOST_OS_ANDROID
|
||||
if (!sl.has_parent_path() && !(mode & load_mode::search_system_folders)) {
|
||||
if (!sl.has_parent_path() && !(native_mode & load_mode::search_system_folders)) {
|
||||
sl = "." / sl;
|
||||
}
|
||||
#else
|
||||
if (!sl.is_absolute() && !(mode & load_mode::search_system_folders)) {
|
||||
if (!sl.is_absolute() && !(native_mode & load_mode::search_system_folders)) {
|
||||
boost::dll::fs::error_code current_path_ec;
|
||||
boost::dll::fs::path prog_loc = boost::dll::fs::current_path(current_path_ec);
|
||||
if (!current_path_ec) {
|
||||
@@ -107,14 +108,14 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
mode &= ~load_mode::search_system_folders;
|
||||
native_mode = static_cast<unsigned>(native_mode) & ~static_cast<unsigned>(load_mode::search_system_folders);
|
||||
|
||||
// Trying to open with appended decorations
|
||||
if (!!(mode & load_mode::append_decorations)) {
|
||||
mode &= ~load_mode::append_decorations;
|
||||
if (!!(native_mode & load_mode::append_decorations)) {
|
||||
native_mode = static_cast<unsigned>(native_mode) & ~static_cast<unsigned>(load_mode::append_decorations);
|
||||
|
||||
boost::dll::fs::path actual_path = decorate(sl);
|
||||
handle_ = dlopen(actual_path.c_str(), static_cast<native_mode_t>(mode));
|
||||
handle_ = dlopen(actual_path.c_str(), native_mode);
|
||||
if (handle_) {
|
||||
boost::dll::detail::reset_dlerror();
|
||||
return;
|
||||
@@ -131,7 +132,7 @@ public:
|
||||
}
|
||||
|
||||
// Opening by exactly specified path
|
||||
handle_ = dlopen(sl.c_str(), static_cast<native_mode_t>(mode));
|
||||
handle_ = dlopen(sl.c_str(), native_mode);
|
||||
if (handle_) {
|
||||
boost::dll::detail::reset_dlerror();
|
||||
return;
|
||||
@@ -153,7 +154,7 @@ public:
|
||||
// returned handle is for the main program.
|
||||
ec.clear();
|
||||
boost::dll::detail::reset_dlerror();
|
||||
handle_ = dlopen(NULL, static_cast<native_mode_t>(mode));
|
||||
handle_ = dlopen(NULL, native_mode);
|
||||
if (!handle_) {
|
||||
ec = boost::dll::fs::make_error_code(
|
||||
boost::dll::fs::errc::bad_file_descriptor
|
||||
|
||||
Reference in New Issue
Block a user