Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add constructor taking native_handle_t #82

Merged
merged 2 commits into from
Dec 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'develop' of github.com:boostorg/dll into HEAD
  • Loading branch information
apolukhin committed Dec 20, 2024
commit 7cbc0d43949e23c6ced418beb992f7113f4feeae
12 changes: 6 additions & 6 deletions include/boost/dll/detail/posix/shared_library_impl.hpp
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ class shared_library_impl {
typedef void* native_handle_t;

shared_library_impl() noexcept
: handle_(NULL)
: handle_(nullptr)
{}

~shared_library_impl() noexcept {
@@ -48,14 +48,14 @@ class shared_library_impl {
shared_library_impl(shared_library_impl&& sl) noexcept
: handle_(sl.handle_)
{
sl.handle_ = NULL;
sl.handle_ = nullptr;
}

shared_library_impl(native_handle_t handle)
explicit shared_library_impl(native_handle_t handle) noexcept
: handle_(handle)
{}

shared_library_impl & operator=(BOOST_RV_REF(shared_library_impl) sl) BOOST_NOEXCEPT {
shared_library_impl & operator=(shared_library_impl&& sl) noexcept {
swap(sl);
return *this;
}
@@ -156,7 +156,7 @@ class shared_library_impl {
// returned handle is for the main program.
ec.clear();
boost::dll::detail::reset_dlerror();
handle_ = dlopen(NULL, native_mode);
handle_ = dlopen(nullptr, native_mode);
if (!handle_) {
ec = std::make_error_code(
std::errc::bad_file_descriptor
@@ -198,7 +198,7 @@ class shared_library_impl {
void* symbol_addr(const char* sb, std::error_code &ec) const noexcept {
// dlsym - obtain the address of a symbol from a dlopen object
void* const symbol = dlsym(handle_, sb);
if (symbol == NULL) {
if (symbol == nullptr) {
ec = std::make_error_code(
std::errc::invalid_seek
);
12 changes: 6 additions & 6 deletions include/boost/dll/detail/windows/shared_library_impl.hpp
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ class shared_library_impl {
typedef boost::winapi::HMODULE_ native_handle_t;

shared_library_impl() noexcept
: handle_(NULL)
: shared_library_impl(nullptr)
{}

~shared_library_impl() noexcept {
@@ -41,14 +41,14 @@ class shared_library_impl {
shared_library_impl(shared_library_impl&& sl) noexcept
: handle_(sl.handle_)
{
sl.handle_ = NULL;
sl.handle_ = nullptr;
}

shared_library_impl(native_handle_t handle)
explicit shared_library_impl(native_handle_t handle) noexcept
: handle_(handle)
{}

shared_library_impl & operator=(BOOST_RV_REF(shared_library_impl) sl) BOOST_NOEXCEPT {
shared_library_impl & operator=(shared_library_impl&& sl) noexcept {
swap(sl);
return *this;
}
@@ -146,7 +146,7 @@ class shared_library_impl {
std::errc::operation_not_supported
);

return NULL;
return nullptr;
}

// Judging by the documentation of GetProcAddress
@@ -155,7 +155,7 @@ class shared_library_impl {
void* const symbol = boost::dll::detail::aggressive_ptr_cast<void*>(
boost::winapi::get_proc_address(handle_, sb)
);
if (symbol == NULL) {
if (symbol == nullptr) {
ec = boost::dll::detail::last_error_code();
}

2 changes: 1 addition & 1 deletion include/boost/dll/shared_library.hpp
Original file line number Diff line number Diff line change
@@ -143,7 +143,7 @@ class shared_library
*
* \param handle The native handle.
*/
explicit shared_library(native_handle_t handle)
explicit shared_library(native_handle_t handle) noexcept
: base_t(handle)
{}

Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.