From d66d4318806d9780a5ee4a57eafa450b0abca009 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Mon, 13 Apr 2026 15:22:05 +0000 Subject: [PATCH 01/35] support cmake tests --- test/CMakeLists.txt | 126 +++++++++++++++++++++++++- test/cmake_subdir_test/CMakeLists.txt | 59 ++++++++++++ 2 files changed, 181 insertions(+), 4 deletions(-) create mode 100644 test/cmake_subdir_test/CMakeLists.txt diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index bc49748b..9d24bea3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,5 @@ # Copyright Antony Polukhin, 2021-2026 +# Copyright Fedor Osetrov, 2025-2026 # # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt @@ -7,8 +8,125 @@ if(NOT TARGET tests) add_custom_target(tests) endif() -add_executable(dll_tests_cpp_mangling "cpp_mangling.cpp") -target_link_libraries(dll_tests_cpp_mangling Boost::dll) -add_test(NAME dll_tests_cpp_mangling COMMAND dll_tests_cpp_mangling) -add_dependencies(tests dll_tests_cpp_mangling) +# Test libraries and plugins +add_library(dll_static_plugin STATIC ../example/tutorial4/static_plugin.cpp) +target_link_libraries(dll_static_plugin PRIVATE Boost::dll) + +add_library(dll_static_refcounting_plugin STATIC ../example/tutorial8/refcounting_plugin.cpp) +target_link_libraries(dll_static_refcounting_plugin PRIVATE Boost::dll) + +add_library(dll_test_library SHARED test_library.cpp) +target_link_libraries(dll_test_library PRIVATE Boost::dll Boost::fusion) + +add_library(dll_empty_library SHARED empty_library.cpp) + +add_library(dll_getting_started_library SHARED ../example/getting_started_library.cpp) +target_link_libraries(dll_getting_started_library PRIVATE Boost::dll) + +add_library(dll_my_plugin_sum SHARED ../example/tutorial1/my_plugin_sum.cpp) +target_link_libraries(dll_my_plugin_sum PRIVATE Boost::dll) +set_target_properties(dll_my_plugin_sum + PROPERTIES + OUTPUT_NAME "my_plugin_sum" +) + +add_library(dll_my_plugin_aggregator SHARED ../example/tutorial2/my_plugin_aggregator.cpp) +target_link_libraries(dll_my_plugin_aggregator PRIVATE Boost::dll) +set_target_properties(dll_my_plugin_aggregator + PROPERTIES + OUTPUT_NAME "my_plugin_aggregator" +) + +add_library(dll_on_unload_lib SHARED ../example/tutorial6/on_unload_lib.cpp) +target_link_libraries(dll_on_unload_lib PRIVATE Boost::dll) + +add_library(dll_library1 SHARED ../example/tutorial7/library1.cpp) +target_link_libraries(dll_library1 PRIVATE Boost::dll) + +add_library(dll_library2 SHARED ../example/tutorial7/library2.cpp) +target_link_libraries(dll_library2 PRIVATE Boost::dll) + +add_library(dll_refcounting_plugin SHARED ../example/tutorial8/refcounting_plugin.cpp) +target_link_libraries(dll_refcounting_plugin PRIVATE Boost::dll) +set_target_properties(dll_refcounting_plugin + PROPERTIES + OUTPUT_NAME "refcounting_plugin" +) + +add_library(dll_cpp_plugin SHARED cpp_test_library.cpp) +target_link_libraries(dll_cpp_plugin PRIVATE Boost::dll Boost::variant) + +add_library(dll_cpp_mangle_plugin SHARED cpp_ctti_type_name_parser_lib.cpp) +target_link_libraries(dll_cpp_mangle_plugin PRIVATE Boost::dll) + +function(boost_dll_add_test name sources export_symbols) + add_executable(${name} ${sources}) + set_target_properties(${name} PROPERTIES ENABLE_EXPORTS ${export_symbols}) + target_link_libraries(${name} PRIVATE Boost::dll Boost::filesystem) + add_test(NAME ${name} COMMAND ${name} ${ARGN}) + add_dependencies(tests ${name}) +endfunction() + +# Examples + +boost_dll_add_test(dll_example_getting_started ../example/getting_started.cpp #[[export_symbols=]] FALSE "$") + +boost_dll_add_test(dll_example_tutorial1_std_shared_ptr ../example/tutorial1/tutorial1.cpp #[[export_symbols=]] FALSE "$") +boost_dll_add_test(dll_example_tutorial1_boost_shared_ptr ../example/tutorial1/tutorial1.cpp #[[export_symbols=]] FALSE "$") + +boost_dll_add_test(dll_example_tutorial2 ../example/tutorial2/tutorial2.cpp #[[export_symbols=]] FALSE "$") + +boost_dll_add_test(dll_example_tutorial3 ../example/tutorial3/tutorial3.cpp #[[export_symbols=]] FALSE "$" "$") + +boost_dll_add_test(dll_example_tutorial4 ../example/tutorial4/load_self.cpp #[[export_symbols=]] TRUE) +target_link_libraries(dll_example_tutorial4 PRIVATE dll_static_plugin) + +boost_dll_add_test(dll_example_tutorial5 ../example/tutorial5/load_all.cpp #[[export_symbols=]] TRUE "${CMAKE_CURRENT_BINARY_DIR}") +target_link_libraries(dll_example_tutorial5 PRIVATE dll_static_plugin) + +boost_dll_add_test(dll_example_tutorial6 ../example/tutorial6/tutorial6.cpp #[[export_symbols=]] FALSE "$") + +boost_dll_add_test(dll_example_tutorial7 ../example/tutorial7/tutorial7.cpp #[[export_symbols=]] FALSE "$" "$") + +boost_dll_add_test(dll_example_tutorial8 ../example/tutorial8/tutorial8.cpp #[[export_symbols=]] FALSE "$") +boost_dll_add_test(dll_example_tutorial8_static ../example/tutorial8/tutorial8_static.cpp #[[export_symbols=]] TRUE) +target_link_libraries(dll_example_tutorial8_static PRIVATE dll_static_refcounting_plugin) + +boost_dll_add_test(dll_example_tutorial9 ../example/tutorial9/tutorial9.cpp #[[export_symbols=]] FALSE) + +# Tests + +add_executable(dll_test_link link1.cpp link2.cpp) +target_link_libraries(dll_test_link PRIVATE Boost::dll) + +boost_dll_add_test(dll_test_structures structures_tests.cpp #[[export_symbols=]] FALSE) +boost_dll_add_test(dll_test_cpp_mangling cpp_mangling.cpp #[[export_symbols=]] FALSE) +boost_dll_add_test(dll_test_cpp_mangle cpp_mangle_test.cpp #[[export_symbols=]] FALSE "$") +target_link_libraries(dll_test_cpp_mangle PRIVATE Boost::variant) +boost_dll_add_test(dll_test_cpp_load cpp_load_test.cpp #[[export_symbols=]] FALSE "$") +target_link_libraries(dll_test_cpp_load PRIVATE Boost::variant) +boost_dll_add_test(dll_test_cpp_import cpp_import_test.cpp #[[export_symbols=]] FALSE "$") +target_link_libraries(dll_test_cpp_import PRIVATE Boost::variant) +if(LINUX) + boost_dll_add_test(dll_test_cpp_template_method_linux template_method_linux_test.cpp #[[export_symbols=]] FALSE "$") +endif() +if(LINUX AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + boost_dll_add_test(dll_test_ctti_type_name_parser ctti_type_name_parser_test.cpp #[[export_symbols=]] FALSE "$") + target_link_libraries(dll_test_ctti_type_name_parser PRIVATE Boost::variant) +endif() +boost_dll_add_test(dll_test_shared_library_load shared_library_load_test.cpp #[[export_symbols=]] FALSE "$" "$") +boost_dll_add_test(dll_test_shared_library_search_symbol shared_library_search_symbol_test.cpp #[[export_symbols=]] TRUE "$") +boost_dll_add_test(dll_test_shared_library_get_symbol shared_library_get_symbol_test.cpp #[[export_symbols=]] TRUE "$") +boost_dll_add_test(dll_test_symbol_runtime_info symbol_runtime_info_test.cpp #[[export_symbols=]] TRUE "$") +boost_dll_add_test(dll_test_shared_library_errors shared_library_errors.cpp #[[export_symbols=]] FALSE "$") +boost_dll_add_test(dll_test_library_info library_info_test.cpp #[[export_symbols=]] FALSE "$") +target_link_libraries(dll_test_library_info PRIVATE dll_static_plugin) +boost_dll_add_test(dll_test_broken_library_info broken_library_info_test.cpp #[[export_symbols=]] FALSE "$") +boost_dll_add_test(dll_test_empty_library_info empty_library_info_test.cpp #[[export_symbols=]] FALSE "$") +boost_dll_add_test(dll_test_shared_library_concurrent_load shared_library_concurrent_load_test.cpp #[[export_symbols=]] FALSE + "$" + "$" + "$" + "$" +) diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt new file mode 100644 index 00000000..17aea2b6 --- /dev/null +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -0,0 +1,59 @@ +# Copyright 2026 Fedor Osetrov +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt + +cmake_minimum_required(VERSION 3.5...4.20) + +project(cmake_subdir_test LANGUAGES CXX) + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + +set(deps + +assert +config +core +predef +system +throw_exception +type_index +winapi + +compat +container_hash +describe +variant +variant2 +integer +mp11 +fusion +function_types +detail +preprocessor +mpl +tuple +type_traits +static_assert +utility +io +typeof +functional +function +bind +filesystem +iterator +concept_check +optional +smart_ptr +scope + +) + +foreach(dep IN LISTS deps) + + add_subdirectory(../../../${dep} boostorg/${dep}) + +endforeach() + +enable_testing() +add_subdirectory(../.. boostorg/dll) From 30d237453e82f06e68d70e661d702b2e44d964db Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Mon, 13 Apr 2026 15:23:49 +0000 Subject: [PATCH 02/35] add .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..002089cf --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build* +.vscode From a8cce34259eba46e9bd3db6ffe7ec2fb8a97148e Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 18 Apr 2026 08:06:51 +0000 Subject: [PATCH 03/35] add cmake tests in CI --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 949ab499..5cb0c38c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,7 @@ jobs: matrix: include: - toolset: gcc-14 # Do not remove! It is the only toolset that tests CMake tests down below + compiler: g++-14 cxxstd: "11,14,17,2a" os: ubuntu-24.04 # UBSAN complains on vtables and fails. No ',undefined -fno-sanitize-recover=undefined' flags! @@ -48,6 +49,17 @@ jobs: - toolset: clang-18 cxxstd: "11,14,17,2a" os: ubuntu-24.04 + - toolset: clang-19 + compiler: clang++-19 + cxxstd: "20,23" + os: ubuntu-24.04 + install: &cxx19 + - clang-19 + - llvm-19 + - libclang-rt-19-dev + - libc++-19-dev + - libc++abi-19-dev + - clang-tools-19 #- toolset: clang # cxxstd: "11,14,17,2a" # os: macos-10.15 @@ -65,7 +77,7 @@ jobs: - name: Install packages if: matrix.install - run: sudo apt install ${{matrix.install}} + run: sudo apt install -y ${{join(matrix.install, ' ')}} - name: Setup Boost run: | @@ -92,16 +104,28 @@ jobs: ./b2 -d0 headers ./b2 -j4 variant=debug tools/inspect + - name: Run CMake subdir tests + if: ${{matrix.toolset == 'gcc-14' || matrix.toolset == 'clang-19'}} + run: | + cd ../boost-root/ + cmake -S test/cmake_subdir_test -B __build \ + -GNinja \ + -DBUILD_TESTING=1 \ + -DCMAKE_CXX_COMPILER=${{matrix.compiler}} + cmake --build __build + ctest --test-dir __build --output-on-failure --no-tests=error + rm -rf __build + - name: Run CMake tests - if: ${{matrix.toolset == 'gcc-14'}} + if: ${{matrix.toolset == 'gcc-14' || matrix.toolset == 'clang-19'}} run: | cd ../boost-root/ - mkdir __build - cd __build - cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=dll -DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_C_COMPILER=gcc-14 .. - cmake --build . --target tests - ctest --output-on-failure --no-tests=error - cd .. + cmake -S . -B __build \ + -DBUILD_TESTING=1 \ + -DBOOST_INCLUDE_LIBRARIES=dll \ + -DCMAKE_CXX_COMPILER=${{matrix.compiler}} + cmake --build __build --target tests + ctest --test-dir __build --output-on-failure --no-tests=error rm -rf __build - name: Run tests From 8432de007fb23012f85dab481df6f40834b790ed Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 18 Apr 2026 08:09:48 +0000 Subject: [PATCH 04/35] up --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5cb0c38c..d76406a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -112,6 +112,7 @@ jobs: -GNinja \ -DBUILD_TESTING=1 \ -DCMAKE_CXX_COMPILER=${{matrix.compiler}} + cmake --build __build ctest --test-dir __build --output-on-failure --no-tests=error rm -rf __build @@ -124,6 +125,7 @@ jobs: -DBUILD_TESTING=1 \ -DBOOST_INCLUDE_LIBRARIES=dll \ -DCMAKE_CXX_COMPILER=${{matrix.compiler}} + cmake --build __build --target tests ctest --test-dir __build --output-on-failure --no-tests=error rm -rf __build From 97c6ba1fc7ca1f7176886e4cb4fb52c5f501f167 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 18 Apr 2026 08:12:03 +0000 Subject: [PATCH 05/35] fix cwd --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d76406a6..c32c1886 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,7 +107,7 @@ jobs: - name: Run CMake subdir tests if: ${{matrix.toolset == 'gcc-14' || matrix.toolset == 'clang-19'}} run: | - cd ../boost-root/ + cd ../boost-root/libs/$LIBRARY cmake -S test/cmake_subdir_test -B __build \ -GNinja \ -DBUILD_TESTING=1 \ @@ -117,7 +117,7 @@ jobs: ctest --test-dir __build --output-on-failure --no-tests=error rm -rf __build - - name: Run CMake tests + - name: Run CMake root tests if: ${{matrix.toolset == 'gcc-14' || matrix.toolset == 'clang-19'}} run: | cd ../boost-root/ From 57ea85ffb5a53489f96d0bac8593ee6911f5e197 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 18 Apr 2026 08:29:56 +0000 Subject: [PATCH 06/35] use std::filesystem in cmake subdir tests --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c32c1886..12084d45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,6 +111,7 @@ jobs: cmake -S test/cmake_subdir_test -B __build \ -GNinja \ -DBUILD_TESTING=1 \ + -DBOOST_DLL_USE_STD_FS=1 \ -DCMAKE_CXX_COMPILER=${{matrix.compiler}} cmake --build __build From 9f20d706c7ef2f72ac149371e29d758b2ef31f66 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 18 Apr 2026 08:36:49 +0000 Subject: [PATCH 07/35] try fix build --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12084d45..e36c4601 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,7 @@ jobs: gcov_tool: "gcov-14" ignore_coverage: "*/detail/pe_info.hpp */detail/macho_info.hpp */filesystem/src/*" - toolset: gcc-14 + compiler: g++-14 cxxstd: "17,2a" os: ubuntu-24.04 # UBSAN complains on vtables and fails. No ',undefined -fno-sanitize-recover=undefined' flags! From 8de946681a224ad02c580880c375a9ccba5869b1 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 18 Apr 2026 08:37:55 +0000 Subject: [PATCH 08/35] try fix build --- test/cmake_subdir_test/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt index 17aea2b6..24ed058d 100644 --- a/test/cmake_subdir_test/CMakeLists.txt +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -10,6 +10,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set(deps +atomic +align assert config core From 8b5b85216b7e956a9e054c5ece1d0e0f284a3e16 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 18 Apr 2026 08:41:44 +0000 Subject: [PATCH 09/35] work --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 89b81847..5311f512 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ target_link_libraries(boost_dll_boost_fs Boost::filesystem ) -# Detault library +# Default library add_library(boost_dll INTERFACE) add_library(Boost::dll ALIAS boost_dll) From 3d97b8b2a4975392cd4eff177de21f8c7041e15e Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 18 Apr 2026 08:46:16 +0000 Subject: [PATCH 10/35] fix debug tests --- .github/workflows/ci.yml | 2 +- test/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e36c4601..d098f17a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -116,7 +116,7 @@ jobs: -DCMAKE_CXX_COMPILER=${{matrix.compiler}} cmake --build __build - ctest --test-dir __build --output-on-failure --no-tests=error + ctest --test-dir __build --output-on-failure --no-tests=error -VV rm -rf __build - name: Run CMake root tests diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9d24bea3..57956196 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -82,7 +82,7 @@ boost_dll_add_test(dll_example_tutorial3 ../example/tutorial3/tutorial3.cpp #[[e boost_dll_add_test(dll_example_tutorial4 ../example/tutorial4/load_self.cpp #[[export_symbols=]] TRUE) target_link_libraries(dll_example_tutorial4 PRIVATE dll_static_plugin) -boost_dll_add_test(dll_example_tutorial5 ../example/tutorial5/load_all.cpp #[[export_symbols=]] TRUE "${CMAKE_CURRENT_BINARY_DIR}") +boost_dll_add_test(dll_example_tutorial5 ../example/tutorial5/load_all.cpp #[[export_symbols=]] TRUE "$" "$" "$") target_link_libraries(dll_example_tutorial5 PRIVATE dll_static_plugin) boost_dll_add_test(dll_example_tutorial6 ../example/tutorial6/tutorial6.cpp #[[export_symbols=]] FALSE "$") From 3bb90299fb6e65e36154589bb782ef7480747052 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 18 Apr 2026 09:23:13 +0000 Subject: [PATCH 11/35] add shared libraries to dependencies --- test/CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 57956196..7b448fe7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -12,17 +12,22 @@ endif() add_library(dll_static_plugin STATIC ../example/tutorial4/static_plugin.cpp) target_link_libraries(dll_static_plugin PRIVATE Boost::dll) +add_dependencies(tests dll_static_plugin) add_library(dll_static_refcounting_plugin STATIC ../example/tutorial8/refcounting_plugin.cpp) target_link_libraries(dll_static_refcounting_plugin PRIVATE Boost::dll) +add_dependencies(tests dll_static_refcounting_plugin) add_library(dll_test_library SHARED test_library.cpp) target_link_libraries(dll_test_library PRIVATE Boost::dll Boost::fusion) +add_dependencies(tests dll_test_library) add_library(dll_empty_library SHARED empty_library.cpp) +add_dependencies(tests dll_empty_library) add_library(dll_getting_started_library SHARED ../example/getting_started_library.cpp) target_link_libraries(dll_getting_started_library PRIVATE Boost::dll) +add_dependencies(tests dll_getting_started_library) add_library(dll_my_plugin_sum SHARED ../example/tutorial1/my_plugin_sum.cpp) target_link_libraries(dll_my_plugin_sum PRIVATE Boost::dll) @@ -30,6 +35,7 @@ set_target_properties(dll_my_plugin_sum PROPERTIES OUTPUT_NAME "my_plugin_sum" ) +add_dependencies(tests dll_my_plugin_sum) add_library(dll_my_plugin_aggregator SHARED ../example/tutorial2/my_plugin_aggregator.cpp) target_link_libraries(dll_my_plugin_aggregator PRIVATE Boost::dll) @@ -37,15 +43,19 @@ set_target_properties(dll_my_plugin_aggregator PROPERTIES OUTPUT_NAME "my_plugin_aggregator" ) +add_dependencies(tests dll_my_plugin_aggregator) add_library(dll_on_unload_lib SHARED ../example/tutorial6/on_unload_lib.cpp) target_link_libraries(dll_on_unload_lib PRIVATE Boost::dll) +add_dependencies(tests dll_on_unload_lib) add_library(dll_library1 SHARED ../example/tutorial7/library1.cpp) target_link_libraries(dll_library1 PRIVATE Boost::dll) +add_dependencies(tests dll_library1) add_library(dll_library2 SHARED ../example/tutorial7/library2.cpp) target_link_libraries(dll_library2 PRIVATE Boost::dll) +add_dependencies(tests dll_library2) add_library(dll_refcounting_plugin SHARED ../example/tutorial8/refcounting_plugin.cpp) target_link_libraries(dll_refcounting_plugin PRIVATE Boost::dll) @@ -53,12 +63,15 @@ set_target_properties(dll_refcounting_plugin PROPERTIES OUTPUT_NAME "refcounting_plugin" ) +add_dependencies(tests dll_refcounting_plugin) add_library(dll_cpp_plugin SHARED cpp_test_library.cpp) target_link_libraries(dll_cpp_plugin PRIVATE Boost::dll Boost::variant) +add_dependencies(tests dll_cpp_plugin) add_library(dll_cpp_mangle_plugin SHARED cpp_ctti_type_name_parser_lib.cpp) target_link_libraries(dll_cpp_mangle_plugin PRIVATE Boost::dll) +add_dependencies(tests dll_cpp_mangle_plugin) function(boost_dll_add_test name sources export_symbols) add_executable(${name} ${sources}) From 1c69709cb0f819f75a8dad72c1363db46f2e86a4 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 07:18:36 +0000 Subject: [PATCH 12/35] add boost.dll module support --- .gitignore | 1 + CMakeLists.txt | 26 +++- example/b2_workarounds.hpp | 3 +- example/getting_started_library.cpp | 2 +- example/tutorial4/load_self.cpp | 4 +- example/tutorial4/static_plugin.hpp | 2 +- example/tutorial6/on_unload_lib.cpp | 2 +- example/tutorial7/library1.cpp | 2 +- example/tutorial7/library2.cpp | 2 +- example/tutorial8/refcounting_api.hpp | 2 +- example/tutorial8/tutorial8_static.cpp | 2 +- include/boost/dll.hpp | 15 ++- include/boost/dll/alias.hpp | 27 ++-- include/boost/dll/config.hpp | 23 +++- .../boost/dll/detail/aggressive_ptr_cast.hpp | 2 + include/boost/dll/detail/config.hpp | 23 ++++ .../dll/detail/demangling/demangle_symbol.hpp | 5 + .../boost/dll/detail/demangling/itanium.hpp | 11 +- .../demangling/mangled_storage_base.hpp | 6 +- include/boost/dll/detail/demangling/msvc.hpp | 6 +- include/boost/dll/detail/elf_info.hpp | 6 +- .../dll/detail/import_mangled_helpers.hpp | 9 +- include/boost/dll/detail/macho_info.hpp | 2 + include/boost/dll/detail/pe_info.hpp | 2 + .../dll/detail/posix/path_from_handle.hpp | 20 ++- .../detail/posix/program_location_impl.hpp | 18 ++- .../dll/detail/posix/shared_library_impl.hpp | 19 +-- include/boost/dll/detail/system_error.hpp | 11 +- include/boost/dll/detail/type_info.hpp | 12 +- .../dll/detail/windows/path_from_handle.hpp | 10 +- .../detail/windows/shared_library_impl.hpp | 17 ++- include/boost/dll/import.hpp | 26 ++-- include/boost/dll/import_class.hpp | 30 +++-- include/boost/dll/import_mangled.hpp | 31 +++-- include/boost/dll/library_info.hpp | 28 +++- include/boost/dll/runtime_symbol_info.hpp | 125 +++++++++++------- include/boost/dll/shared_library.hpp | 32 +++-- .../boost/dll/shared_library_load_mode.hpp | 25 +++- include/boost/dll/smart_library.hpp | 36 +++-- modules/boost_dll.cppm | 44 ++++++ test/broken_library_info_test.cpp | 4 +- test/cpp_ctti_type_name_parser_lib.cpp | 3 +- test/cpp_load_test.cpp | 4 +- test/cpp_mangle_test.cpp | 4 +- test/cpp_test_library.cpp | 4 +- test/shared_library_load_test.cpp | 3 +- test/structures_tests.cpp | 7 +- test/template_method_linux_test.cpp | 8 +- test/test_library.cpp | 5 +- 49 files changed, 505 insertions(+), 206 deletions(-) create mode 100644 include/boost/dll/detail/config.hpp create mode 100644 modules/boost_dll.cppm diff --git a/.gitignore b/.gitignore index 002089cf..0295863d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +.cache build* .vscode diff --git a/CMakeLists.txt b/CMakeLists.txt index 5311f512..6e67039d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ # Distributed under the Boost Software License, Version 1.0. # https://www.boost.org/LICENSE_1_0.txt -cmake_minimum_required(VERSION 3.5...3.16) +cmake_minimum_required(VERSION 3.5...4.20) project(boost_dll VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) @@ -50,14 +50,30 @@ target_link_libraries(boost_dll_boost_fs # Default library -add_library(boost_dll INTERFACE) +if (BOOST_USE_MODULES) + add_library(boost_dll) + target_compile_definitions(boost_dll PUBLIC BOOST_USE_MODULES) + target_compile_features(boost_dll PUBLIC cxx_std_20) + target_sources(boost_dll + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/modules + FILES ${CMAKE_CURRENT_SOURCE_DIR}/modules/boost_dll.cppm + ) + set(__scope PUBLIC) +else() + add_library(boost_dll INTERFACE) + set(__scope INTERFACE) +endif() + add_library(Boost::dll ALIAS boost_dll) -target_include_directories(boost_dll INTERFACE include) +target_include_directories(boost_dll ${__scope} include) if (BOOST_DLL_USE_STD_FS) - target_link_libraries(boost_dll INTERFACE Boost::dll_std_fs) + target_link_libraries(boost_dll ${__scope} Boost::dll_std_fs) else() - target_link_libraries(boost_dll INTERFACE Boost::dll_boost_fs) + target_link_libraries(boost_dll ${__scope} Boost::dll_boost_fs) endif() +unset(__scope) if (BOOST_SUPERPROJECT_VERSION AND NOT CMAKE_VERSION VERSION_LESS 3.13) boost_install( diff --git a/example/b2_workarounds.hpp b/example/b2_workarounds.hpp index 2a5fdfe0..bd37c95d 100644 --- a/example/b2_workarounds.hpp +++ b/example/b2_workarounds.hpp @@ -8,12 +8,13 @@ #ifndef BOOST_DLL_EXAMPLE_COMMON_B2_WORKAROUNDS_HPP #define BOOST_DLL_EXAMPLE_COMMON_B2_WORKAROUNDS_HPP -#include #include #include #include #include +#include + namespace b2_workarounds { diff --git a/example/getting_started_library.cpp b/example/getting_started_library.cpp index 33a4268c..e287331c 100644 --- a/example/getting_started_library.cpp +++ b/example/getting_started_library.cpp @@ -8,8 +8,8 @@ // MinGW related workaround #define BOOST_DLL_FORCE_ALIAS_INSTANTIATION -#include #include +#include #define API extern "C" BOOST_SYMBOL_EXPORT diff --git a/example/tutorial4/load_self.cpp b/example/tutorial4/load_self.cpp index bb8f36c4..dfb011fe 100644 --- a/example/tutorial4/load_self.cpp +++ b/example/tutorial4/load_self.cpp @@ -9,11 +9,11 @@ #define BOOST_DLL_FORCE_ALIAS_INSTANTIATION //[plugcpp_my_plugin_load_self -#include // for shared_library -#include // for program_location() #include "static_plugin.hpp" // without this headers some compilers may optimize out the `create_plugin` symbol #include #include +#include // for shared_library +#include // for program_location() namespace dll = boost::dll; diff --git a/example/tutorial4/static_plugin.hpp b/example/tutorial4/static_plugin.hpp index ed78a540..e3977161 100644 --- a/example/tutorial4/static_plugin.hpp +++ b/example/tutorial4/static_plugin.hpp @@ -6,9 +6,9 @@ // or copy at http://www.boost.org/LICENSE_1_0.txt) //[plugcpp_my_plugin_static -#include // for BOOST_DLL_ALIAS #include #include "../tutorial_common/my_plugin_api.hpp" +#include // for BOOST_DLL_ALIAS namespace my_namespace { std::shared_ptr create_plugin(); // Forward declaration diff --git a/example/tutorial6/on_unload_lib.cpp b/example/tutorial6/on_unload_lib.cpp index 4320de7f..326e3570 100644 --- a/example/tutorial6/on_unload_lib.cpp +++ b/example/tutorial6/on_unload_lib.cpp @@ -9,9 +9,9 @@ #define BOOST_DLL_FORCE_ALIAS_INSTANTIATION //[plugcpp_on_unload -#include // for BOOST_DLL_ALIAS #include #include +#include // for BOOST_DLL_ALIAS namespace my_namespace { diff --git a/example/tutorial7/library1.cpp b/example/tutorial7/library1.cpp index 668a8107..de0c4595 100644 --- a/example/tutorial7/library1.cpp +++ b/example/tutorial7/library1.cpp @@ -9,9 +9,9 @@ #define BOOST_DLL_FORCE_ALIAS_INSTANTIATION //[plugcpp_tutorial7_library1 -#include // for BOOST_DLL_ALIAS_SECTIONED #include #include +#include // for BOOST_DLL_ALIAS_SECTIONED void print(const std::string& s) { std::cout << "Hello, " << s << '!' << std::endl; diff --git a/example/tutorial7/library2.cpp b/example/tutorial7/library2.cpp index 326c0356..8c5bd95c 100644 --- a/example/tutorial7/library2.cpp +++ b/example/tutorial7/library2.cpp @@ -9,9 +9,9 @@ #define BOOST_DLL_FORCE_ALIAS_INSTANTIATION //[plugcpp_tutorial7_library2 -#include // for BOOST_DLL_ALIAS_SECTIONED #include #include +#include // for BOOST_DLL_ALIAS_SECTIONED void print_howdy(const std::string& s) { std::cout << "How're you doing, " << s << '?' << std::endl; diff --git a/example/tutorial8/refcounting_api.hpp b/example/tutorial8/refcounting_api.hpp index a5062070..94417ee7 100644 --- a/example/tutorial8/refcounting_api.hpp +++ b/example/tutorial8/refcounting_api.hpp @@ -7,6 +7,7 @@ //[plugcpp_my_plugin_refcounting_api #include "../tutorial_common/my_plugin_api.hpp" +#include #include class my_refcounting_api: public my_plugin_api { @@ -19,7 +20,6 @@ class my_refcounting_api: public my_plugin_api { //[plugcpp_library_holding_deleter_api_bind -#include #include struct library_holding_deleter { diff --git a/example/tutorial8/tutorial8_static.cpp b/example/tutorial8/tutorial8_static.cpp index 9cc03a41..3405e1d2 100644 --- a/example/tutorial8/tutorial8_static.cpp +++ b/example/tutorial8/tutorial8_static.cpp @@ -6,9 +6,9 @@ // or copy at http://www.boost.org/LICENSE_1_0.txt) //[callplugcpp_tutorial8_static -#include // program_location() #include #include "refcounting_plugin.hpp" +#include // program_location() int main() { std::shared_ptr plugin = get_plugin( diff --git a/include/boost/dll.hpp b/include/boost/dll.hpp index 37a8f9f7..0f7c3e2b 100644 --- a/include/boost/dll.hpp +++ b/include/boost/dll.hpp @@ -12,16 +12,23 @@ /// \file boost/dll.hpp /// \brief Includes all the non-experimental headers of the Boost.DLL library. +#include + +#if !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + #include #include -#include #include #include #include -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + +#include #endif // BOOST_DLL_DLL_HPP diff --git a/include/boost/dll/alias.hpp b/include/boost/dll/alias.hpp index 646e0d0f..569a0b7a 100644 --- a/include/boost/dll/alias.hpp +++ b/include/boost/dll/alias.hpp @@ -5,26 +5,36 @@ // (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) +/// \file boost/dll/alias.hpp +/// \brief Includes alias methods and macro. You can include this header or +/// boost/dll/shared_library.hpp to reduce dependencies +/// in case you do not use the refcountable functions. + #ifndef BOOST_DLL_ALIAS_HPP #define BOOST_DLL_ALIAS_HPP +#include + +#if !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + #include + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include -#include #if BOOST_COMP_GNUC // MSVC does not have and defines it in some other header, MinGW requires that header. #include // intptr_t #endif +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif +#include -/// \file boost/dll/alias.hpp -/// \brief Includes alias methods and macro. You can include this header or -/// boost/dll/shared_library.hpp to reduce dependencies -/// in case you do not use the refcountable functions. +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { @@ -284,6 +294,5 @@ namespace boost { namespace dll { }} // namespace boost::dll - #endif // BOOST_DLL_ALIAS_HPP diff --git a/include/boost/dll/config.hpp b/include/boost/dll/config.hpp index 664320ff..6631287a 100644 --- a/include/boost/dll/config.hpp +++ b/include/boost/dll/config.hpp @@ -7,10 +7,11 @@ /// \file boost/dll/config.hpp /// \brief Imports filesystem, error_code, errc, system_error, make_error_code from Boost or C++17 into `boost::dll::fs` namespace. -#ifndef BOOST_DLL_DETAIL_CONFIG_HPP -#define BOOST_DLL_DETAIL_CONFIG_HPP +#ifndef BOOST_DLL_CONFIG_HPP +#define BOOST_DLL_CONFIG_HPP + +#include -#include #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif @@ -44,25 +45,32 @@ using system_error = std::conditional_t +#if !defined(BOOST_DLL_INTERFACE_UNIT) +#include #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace fs { +BOOST_DLL_BEGIN_MODULE_EXPORT using namespace std::filesystem; using std::error_code; using std::system_error; +BOOST_DLL_END_MODULE_EXPORT }}} #else // BOOST_DLL_USE_STD_FS +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include #include #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) +BOOST_DLL_BEGIN_MODULE_EXPORT namespace boost { namespace dll { namespace fs { using namespace boost::filesystem; @@ -70,13 +78,16 @@ using boost::system::error_code; using boost::system::system_error; }}} +BOOST_DLL_END_MODULE_EXPORT #endif // BOOST_DLL_USE_STD_FS #ifdef BOOST_DLL_USE_BOOST_SHARED_PTR +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { template @@ -86,7 +97,9 @@ namespace boost { namespace dll { namespace detail { #else // BOOST_DLL_USE_STD_FS +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { template @@ -96,5 +109,5 @@ namespace boost { namespace dll { namespace detail { #endif // BOOST_DLL_USE_STD_FS -#endif // BOOST_DLL_DETAIL_PUSH_OPTIONS_HPP +#endif // BOOST_DLL_CONFIG_HPP diff --git a/include/boost/dll/detail/aggressive_ptr_cast.hpp b/include/boost/dll/detail/aggressive_ptr_cast.hpp index 81bdf11b..e50cc8da 100644 --- a/include/boost/dll/detail/aggressive_ptr_cast.hpp +++ b/include/boost/dll/detail/aggressive_ptr_cast.hpp @@ -13,9 +13,11 @@ # pragma once #endif +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include // std::memcpy #include #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) #if defined(__GNUC__) && defined(__GNUC_MINOR__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 301) # pragma GCC system_header diff --git a/include/boost/dll/detail/config.hpp b/include/boost/dll/detail/config.hpp new file mode 100644 index 00000000..a3fa1dd7 --- /dev/null +++ b/include/boost/dll/detail/config.hpp @@ -0,0 +1,23 @@ +#ifndef BOOST_DLL_DETAIL_CONFIG_HPP +#define BOOST_DLL_DETAIL_CONFIG_HPP + +#if !defined(BOOST_DLL_INTERFACE_UNIT) +# include +# ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +# endif +#endif + +#ifdef BOOST_DLL_INTERFACE_UNIT +# define BOOST_DLL_BEGIN_MODULE_EXPORT export { +# define BOOST_DLL_END_MODULE_EXPORT } +#else +# define BOOST_DLL_BEGIN_MODULE_EXPORT +# define BOOST_DLL_END_MODULE_EXPORT +#endif + +#if defined(BOOST_USE_MODULES) && !defined(BOOST_DLL_INTERFACE_UNIT) +import boost.dll; +#endif + +#endif // BOOST_DLL_DETAIL_CONFIG_HPP diff --git a/include/boost/dll/detail/demangling/demangle_symbol.hpp b/include/boost/dll/detail/demangling/demangle_symbol.hpp index 57e82877..5a1599af 100644 --- a/include/boost/dll/detail/demangling/demangle_symbol.hpp +++ b/include/boost/dll/detail/demangling/demangle_symbol.hpp @@ -9,9 +9,12 @@ #define BOOST_DLL_DEMANGLE_SYMBOL_HPP_ #include + +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) #if defined(_MSC_VER) // MSVC, Clang-cl, and ICC on Windows @@ -61,7 +64,9 @@ inline std::string demangle_symbol(const std::string& mangled_name) }}} #else +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { diff --git a/include/boost/dll/detail/demangling/itanium.hpp b/include/boost/dll/detail/demangling/itanium.hpp index 8fe148b9..b08ed38d 100644 --- a/include/boost/dll/detail/demangling/itanium.hpp +++ b/include/boost/dll/detail/demangling/itanium.hpp @@ -7,15 +7,16 @@ #ifndef BOOST_DLL_DETAIL_DEMANGLING_ITANIUM_HPP_ #define BOOST_DLL_DETAIL_DEMANGLING_ITANIUM_HPP_ -#include - +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) +#include -namespace boost { namespace dll { namespace detail { +namespace boost { namespace dll { namespace detail { class mangled_storage_impl : public mangled_storage_base { @@ -80,8 +81,6 @@ class mangled_storage_impl : public mangled_storage_base }; - - namespace parser { //! declare @@ -284,8 +283,6 @@ namespace parser } } - - template std::string mangled_storage_impl::get_variable(const std::string &name) const { auto found = std::find_if(storage_.begin(), storage_.end(), diff --git a/include/boost/dll/detail/demangling/mangled_storage_base.hpp b/include/boost/dll/detail/demangling/mangled_storage_base.hpp index 32d0a7cc..b072a9b2 100644 --- a/include/boost/dll/detail/demangling/mangled_storage_base.hpp +++ b/include/boost/dll/detail/demangling/mangled_storage_base.hpp @@ -7,15 +7,17 @@ #ifndef BOOST_DLL_DETAIL_MANGLE_STORAGE_BASE_HPP_ #define BOOST_DLL_DETAIL_MANGLE_STORAGE_BASE_HPP_ +#if !defined(BOOST_DLL_INTERFACE_UNIT) +#include + #include #include #include #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) #include #include -#include - namespace boost { namespace dll { namespace detail { diff --git a/include/boost/dll/detail/demangling/msvc.hpp b/include/boost/dll/detail/demangling/msvc.hpp index 13437659..47740a12 100644 --- a/include/boost/dll/detail/demangling/msvc.hpp +++ b/include/boost/dll/detail/demangling/msvc.hpp @@ -7,13 +7,15 @@ #ifndef BOOST_DLL_DETAIL_DEMANGLING_MSVC_HPP_ #define BOOST_DLL_DETAIL_DEMANGLING_MSVC_HPP_ -#include - +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include #include #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) + +#include namespace boost { namespace dll { namespace detail { diff --git a/include/boost/dll/detail/elf_info.hpp b/include/boost/dll/detail/elf_info.hpp index 1b90d548..363ce55b 100644 --- a/include/boost/dll/detail/elf_info.hpp +++ b/include/boost/dll/detail/elf_info.hpp @@ -14,12 +14,14 @@ # pragma once #endif +#if !defined(BOOST_DLL_INTERFACE_UNIT) +#include + #include #include #include #include - -#include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { diff --git a/include/boost/dll/detail/import_mangled_helpers.hpp b/include/boost/dll/detail/import_mangled_helpers.hpp index c1c77813..b7f7353e 100644 --- a/include/boost/dll/detail/import_mangled_helpers.hpp +++ b/include/boost/dll/detail/import_mangled_helpers.hpp @@ -7,14 +7,15 @@ #ifndef BOOST_DLL_DETAIL_IMPORT_MANGLED_HELPERS_HPP_ #define BOOST_DLL_DETAIL_IMPORT_MANGLED_HELPERS_HPP_ - -#include - - +#include #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif +#if !defined(BOOST_DLL_INTERFACE_UNIT) +#include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) + namespace boost { namespace dll { namespace experimental { namespace detail { //the following could be done by fusion, though it's simple enough to just declare it here. diff --git a/include/boost/dll/detail/macho_info.hpp b/include/boost/dll/detail/macho_info.hpp index aadcb2ec..bb9bd715 100644 --- a/include/boost/dll/detail/macho_info.hpp +++ b/include/boost/dll/detail/macho_info.hpp @@ -14,11 +14,13 @@ # pragma once #endif +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include #include #include // for std::getline #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { diff --git a/include/boost/dll/detail/pe_info.hpp b/include/boost/dll/detail/pe_info.hpp index eabf6e0a..acbb9c08 100644 --- a/include/boost/dll/detail/pe_info.hpp +++ b/include/boost/dll/detail/pe_info.hpp @@ -14,11 +14,13 @@ # pragma once #endif +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include #include #include // for std::getline #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { diff --git a/include/boost/dll/detail/posix/path_from_handle.hpp b/include/boost/dll/detail/posix/path_from_handle.hpp index d34413c8..cce67c69 100644 --- a/include/boost/dll/detail/posix/path_from_handle.hpp +++ b/include/boost/dll/detail/posix/path_from_handle.hpp @@ -9,19 +9,25 @@ #define BOOST_DLL_DETAIL_POSIX_PATH_FROM_HANDLE_HPP #include -#include -#include -#include #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif +#if !defined(BOOST_DLL_INTERFACE_UNIT) +#include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) + +#include +#include + #if BOOST_OS_MACOS || BOOST_OS_IOS +#if !defined(BOOST_DLL_INTERFACE_UNIT) # include # include # include // for std::ptrdiff_t +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { inline void* strip_handle(void* handle) noexcept { @@ -64,7 +70,9 @@ namespace boost { namespace dll { namespace detail { #elif BOOST_OS_ANDROID +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { @@ -99,11 +107,15 @@ namespace boost { namespace dll { namespace detail { #else // #if BOOST_OS_MACOS || BOOST_OS_IOS || BOOST_OS_ANDROID // for dlinfo +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) #if BOOST_OS_QNX // QNX's copy of and reside in sys folder +# if !defined(BOOST_DLL_INTERFACE_UNIT) # include +# endif // !defined(BOOST_DLL_INTERFACE_UNIT) #elif BOOST_OS_CYGWIN // Cygwin returns the opaque pointer-sized handle of type `HMODULE` on the invoke of `dlopen`, // which cannot be interpreted. As GCC on Cygwin always links to KERNEL32.DLL, we can use the @@ -114,7 +126,9 @@ extern "C" void GetModuleFileNameW(void*, wchar_t*, unsigned long long); // Introduce the Win32 API `GetLastError` here extern "C" unsigned long long GetLastError(); #else +# if !defined(BOOST_DLL_INTERFACE_UNIT) # include // struct link_map +# endif // !defined(BOOST_DLL_INTERFACE_UNIT) #endif namespace boost { namespace dll { namespace detail { diff --git a/include/boost/dll/detail/posix/program_location_impl.hpp b/include/boost/dll/detail/posix/program_location_impl.hpp index 5e491cf5..b0034524 100644 --- a/include/boost/dll/detail/posix/program_location_impl.hpp +++ b/include/boost/dll/detail/posix/program_location_impl.hpp @@ -9,17 +9,23 @@ #define BOOST_DLL_DETAIL_POSIX_PROGRAM_LOCATION_IMPL_HPP #include -#include -#include #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif +#if !defined(BOOST_DLL_INTERFACE_UNIT) +#include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) + +#include + #if BOOST_OS_MACOS || BOOST_OS_IOS +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { inline boost::dll::fs::path program_location_impl(std::error_code &ec) { @@ -44,7 +50,10 @@ namespace boost { namespace dll { namespace detail { #elif BOOST_OS_SOLARIS +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) + namespace boost { namespace dll { namespace detail { inline boost::dll::fs::path program_location_impl(std::error_code& ec) { ec.clear(); @@ -55,10 +64,12 @@ namespace boost { namespace dll { namespace detail { #elif BOOST_OS_BSD_FREE +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include #include #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { inline boost::dll::fs::path program_location_impl(std::error_code& ec) { @@ -121,8 +132,11 @@ namespace boost { namespace dll { namespace detail { #elif BOOST_OS_QNX +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include // for std::getline +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) + namespace boost { namespace dll { namespace detail { inline boost::dll::fs::path program_location_impl(std::error_code &ec) { ec.clear(); diff --git a/include/boost/dll/detail/posix/shared_library_impl.hpp b/include/boost/dll/detail/posix/shared_library_impl.hpp index b3879a77..11753e8b 100644 --- a/include/boost/dll/detail/posix/shared_library_impl.hpp +++ b/include/boost/dll/detail/posix/shared_library_impl.hpp @@ -9,10 +9,12 @@ #define BOOST_DLL_SHARED_LIBRARY_IMPL_HPP #include -#include -#include -#include +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include @@ -26,10 +28,11 @@ // QNX's copy of and reside in sys folder # include #endif +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif +#include +#include +#include namespace boost { namespace dll { namespace detail { @@ -123,8 +126,8 @@ class shared_library_impl { return; } boost::dll::fs::error_code prog_loc_err; - boost::dll::fs::path loc = boost::dll::detail::program_location_impl(prog_loc_err); - if (boost::dll::fs::exists(actual_path) && !boost::dll::fs::equivalent(sl, loc, prog_loc_err)) { + boost::dll::fs::path l = boost::dll::detail::program_location_impl(prog_loc_err); + if (boost::dll::fs::exists(actual_path) && !boost::dll::fs::equivalent(sl, l, prog_loc_err)) { // decorated path exists : current error is not a bad file descriptor and we are not trying to load the executable itself ec = std::make_error_code( std::errc::executable_format_error diff --git a/include/boost/dll/detail/system_error.hpp b/include/boost/dll/detail/system_error.hpp index 87fbedda..d024fd6c 100644 --- a/include/boost/dll/detail/system_error.hpp +++ b/include/boost/dll/detail/system_error.hpp @@ -8,17 +8,20 @@ #ifndef BOOST_DLL_SYSTEM_ERROR_HPP #define BOOST_DLL_SYSTEM_ERROR_HPP +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + #include + +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include #if !BOOST_OS_WINDOWS # include #endif - -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { diff --git a/include/boost/dll/detail/type_info.hpp b/include/boost/dll/detail/type_info.hpp index c9ba6832..4754294e 100644 --- a/include/boost/dll/detail/type_info.hpp +++ b/include/boost/dll/detail/type_info.hpp @@ -9,12 +9,16 @@ #ifndef BOOST_DLL_DETAIL_TYPE_INFO_HPP_ #define BOOST_DLL_DETAIL_TYPE_INFO_HPP_ +#include + +#if !defined(BOOST_DLL_INTERFACE_UNIT) +# if defined(_MSC_VER) // MSVC, Clang-cl, and ICC on Windows +# include +# endif + #include #include -#include -#if defined(_MSC_VER) // MSVC, Clang-cl, and ICC on Windows -#include -#endif +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { diff --git a/include/boost/dll/detail/windows/path_from_handle.hpp b/include/boost/dll/detail/windows/path_from_handle.hpp index 42649994..4ad561d1 100644 --- a/include/boost/dll/detail/windows/path_from_handle.hpp +++ b/include/boost/dll/detail/windows/path_from_handle.hpp @@ -9,14 +9,18 @@ #define BOOST_DLL_DETAIL_WINDOWS_PATH_FROM_HANDLE_HPP #include -#include -#include -#include #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif +#if !defined(BOOST_DLL_INTERFACE_UNIT) +#include +#include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) + +#include + namespace boost { namespace dll { namespace detail { inline std::error_code last_error_code() noexcept { diff --git a/include/boost/dll/detail/windows/shared_library_impl.hpp b/include/boost/dll/detail/windows/shared_library_impl.hpp index 4af244dd..a9ee2ab3 100644 --- a/include/boost/dll/detail/windows/shared_library_impl.hpp +++ b/include/boost/dll/detail/windows/shared_library_impl.hpp @@ -9,20 +9,23 @@ #define BOOST_DLL_SHARED_LIBRARY_IMPL_HPP #include -#include -#include -#include -#include +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include #include // std::move +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif +#include +#include +#include +#include namespace boost { namespace dll { namespace detail { diff --git a/include/boost/dll/import.hpp b/include/boost/dll/import.hpp index 9429fac2..8817b488 100644 --- a/include/boost/dll/import.hpp +++ b/include/boost/dll/import.hpp @@ -5,23 +5,29 @@ // (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) +/// \file boost/dll/import.hpp +/// \brief Contains all the boost::dll::import* reference counting +/// functions that hold a shared pointer to the instance of +/// boost::dll::shared_library. + #ifndef BOOST_DLL_IMPORT_HPP #define BOOST_DLL_IMPORT_HPP -#include -#include +#include -#include // std::addressof -#include +#if !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif -/// \file boost/dll/import.hpp -/// \brief Contains all the boost::dll::import* reference counting -/// functions that hold a shared pointer to the instance of -/// boost::dll::shared_library. +#if !defined(BOOST_DLL_INTERFACE_UNIT) +#include // std::addressof +#include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) + +#include +#include namespace boost { namespace dll { @@ -67,6 +73,7 @@ namespace detail { # define BOOST_DLL_IMPORT_RESULT_TYPE inline boost::dll::detail::import_type #endif +BOOST_DLL_BEGIN_MODULE_EXPORT /*! * Returns callable object or std::shared_ptr (boost::shared_ptr if @@ -253,8 +260,11 @@ BOOST_DLL_IMPORT_RESULT_TYPE import_alias(shared_library&& lib, const std::strin #undef BOOST_DLL_IMPORT_RESULT_TYPE +BOOST_DLL_END_MODULE_EXPORT }} // boost::dll +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + #endif // BOOST_DLL_IMPORT_HPP diff --git a/include/boost/dll/import_class.hpp b/include/boost/dll/import_class.hpp index de974d7c..09fbf835 100644 --- a/include/boost/dll/import_class.hpp +++ b/include/boost/dll/import_class.hpp @@ -5,28 +5,35 @@ // (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_DLL_IMPORT_CLASS_HPP_ -#define BOOST_DLL_IMPORT_CLASS_HPP_ - /// \file boost/dll/import_class.hpp /// \warning Experimental feature that relies on an incomplete implementation of platform specific C++ /// mangling. In case of an issue provide a PR with a fix and tests to https://github.com/boostorg/dll . /// boost/dll/import_class.hpp is not included in boost/dll.hpp /// \brief Contains the boost::dll::experimental::import_class function for importing classes. -#include -#include +#ifndef BOOST_DLL_IMPORT_CLASS_HPP_ +#define BOOST_DLL_IMPORT_CLASS_HPP_ + +#include + +#if !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include // std::move +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) + +#include +#include #if (__cplusplus < 201103L) && (!defined(_MSVC_LANG) || _MSVC_LANG < 201103L) # error This file requires C++11 at least! #endif -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - namespace boost { namespace dll { namespace experimental { namespace detail @@ -99,6 +106,8 @@ struct mem_fn_call_proxy } +BOOST_DLL_BEGIN_MODULE_EXPORT + template class imported_class; @@ -250,6 +259,7 @@ class imported_class } }; +BOOST_DLL_END_MODULE_EXPORT //helper function, uses the allocating @@ -512,6 +522,6 @@ import_class(smart_library & lib, const std::string & alias_name, std::size_t si } } - +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) #endif /* BOOST_DLL_IMPORT_CLASS_HPP_ */ diff --git a/include/boost/dll/import_mangled.hpp b/include/boost/dll/import_mangled.hpp index 301a954e..1607a99e 100644 --- a/include/boost/dll/import_mangled.hpp +++ b/include/boost/dll/import_mangled.hpp @@ -5,31 +5,36 @@ // (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_DLL_IMPORT_MANGLED_HPP_ -#define BOOST_DLL_IMPORT_MANGLED_HPP_ - /// \file boost/dll/import_mangled.hpp /// \warning Experimental feature that relies on an incomplete implementation of platform specific C++ /// mangling. In case of an issue provide a PR with a fix and tests to https://github.com/boostorg/dll . /// boost/dll/import_mangled.hpp is not included in boost/dll.hpp /// \brief Contains the boost::dll::experimental::import_mangled function for importing mangled symbols. +#ifndef BOOST_DLL_IMPORT_MANGLED_HPP_ +#define BOOST_DLL_IMPORT_MANGLED_HPP_ + +#include + +#if !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + #include #if (__cplusplus < 201103L) && (!defined(_MSVC_LANG) || _MSVC_LANG < 201103L) # error This file requires C++11 at least! #endif -#include -#include -#include - +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include // std::addressof #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) - -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif +#include +#include +#include namespace boost { namespace dll { namespace experimental { @@ -226,6 +231,7 @@ struct mangled_import_type, false, false, true> //is variable * Overload that accepts path also throws std::bad_alloc in case of insufficient memory. */ +BOOST_DLL_BEGIN_MODULE_EXPORT template BOOST_DLL_MANGLED_IMPORT_RESULT_TYPE import_mangled(const boost::dll::fs::path& lib, const char* name, @@ -306,9 +312,12 @@ BOOST_DLL_MANGLED_IMPORT_RESULT_TYPE import_mangled(shared_library&& lib, const return boost::dll::experimental::import_mangled(std::move(lib), name.c_str()); } +BOOST_DLL_END_MODULE_EXPORT + #undef BOOST_DLL_MANGLED_IMPORT_RESULT_TYPE }}} +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) #endif /* BOOST_DLL_IMPORT_MANGLED_HPP_ */ diff --git a/include/boost/dll/library_info.hpp b/include/boost/dll/library_info.hpp index b9441000..352fe8ed 100644 --- a/include/boost/dll/library_info.hpp +++ b/include/boost/dll/library_info.hpp @@ -5,10 +5,24 @@ // (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) +/// \file boost/dll/library_info.hpp +/// \brief Contains only the boost::dll::library_info class that is capable of +/// extracting different information from binaries. + #ifndef BOOST_DLL_LIBRARY_INFO_HPP #define BOOST_DLL_LIBRARY_INFO_HPP +#include + +#if !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + #include + +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include #include @@ -17,18 +31,13 @@ #include #include +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) #include #include #include -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -/// \file boost/dll/library_info.hpp -/// \brief Contains only the boost::dll::library_info class that is capable of -/// extracting different information from binaries. +BOOST_DLL_BEGIN_MODULE_EXPORT namespace boost { namespace dll { @@ -210,4 +219,9 @@ class library_info: private boost::noncopyable { }; }} // namespace boost::dll + +BOOST_DLL_END_MODULE_EXPORT + +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + #endif // BOOST_DLL_LIBRARY_INFO_HPP diff --git a/include/boost/dll/runtime_symbol_info.hpp b/include/boost/dll/runtime_symbol_info.hpp index e2a46926..71db1135 100644 --- a/include/boost/dll/runtime_symbol_info.hpp +++ b/include/boost/dll/runtime_symbol_info.hpp @@ -5,19 +5,38 @@ // (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) +/// \file boost/dll/runtime_symbol_info.hpp +/// \brief Provides methods for getting acceptable by boost::dll::shared_library location of symbol, source line or program. + #ifndef BOOST_DLL_RUNTIME_SYMBOL_INFO_HPP #define BOOST_DLL_RUNTIME_SYMBOL_INFO_HPP +#include + #include +#include + +#if !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include -#include + +#include // std::addressof +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) #if BOOST_OS_WINDOWS +# if !defined(BOOST_DLL_INTERFACE_UNIT) # include # include +# endif // !defined(BOOST_DLL_INTERFACE_UNIT) #else -#if BOOST_OS_CYGWIN + +# if BOOST_OS_CYGWIN // `Dl_info` & `dladdr` is hidden by `__GNU_VISIBLE` typedef struct Dl_info Dl_info; @@ -30,19 +49,16 @@ struct Dl_info }; extern "C" int dladdr (const void *addr, Dl_info *info); -#endif +# endif // BOOST_OS_CYGWIN + +# if !defined(BOOST_DLL_INTERFACE_UNIT) # include # include +# endif // !defined(BOOST_DLL_INTERFACE_UNIT) #endif -#include // std::addressof - -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif +#include -/// \file boost/dll/runtime_symbol_info.hpp -/// \brief Provides methods for getting acceptable by boost::dll::shared_library location of symbol, source line or program. namespace boost { namespace dll { #if BOOST_OS_WINDOWS @@ -53,6 +69,8 @@ namespace detail { } // namespace detail #endif +BOOST_DLL_BEGIN_MODULE_EXPORT + /*! * On success returns full path and name to the binary object that holds symbol pointed by ptr_to_symbol. * @@ -182,43 +200,6 @@ namespace detail { return ret; } - /// @cond - // We have anonymous namespace here to make sure that `this_line_location()` method is instantiated in - // current translation unit and is not shadowed by instantiations from other units. - // - // boost-no-inspect - namespace { - /// @endcond - - /*! - * On success returns full path and name of the binary object that holds the current line of code - * (the line in which the `this_line_location()` method was called). - * - * \param ec Variable that will be set to the result of the operation. - * \throws std::bad_alloc in case of insufficient memory. Overload that does not accept \forcedlinkfs{error_code} also throws \forcedlinkfs{system_error}. - */ - static inline boost::dll::fs::path this_line_location(std::error_code& ec) { - typedef boost::dll::fs::path(func_t)(std::error_code& ); - func_t& f = this_line_location; - return boost::dll::symbol_location(f, ec); - } - - //! \overload this_line_location(std::error_code& ec) - static inline boost::dll::fs::path this_line_location() { - boost::dll::fs::path ret; - std::error_code ec; - ret = this_line_location(ec); - - if (ec) { - boost::dll::detail::report_error(ec, "boost::dll::this_line_location() failed"); - } - - return ret; - } - - /// @cond - } // anonymous namespace - /// @endcond /*! * On success returns full path and name of the currently running program (the one which contains the `main()` function). @@ -248,7 +229,57 @@ namespace detail { return ret; } +BOOST_DLL_END_MODULE_EXPORT + }} // namespace boost::dll +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + +#if !defined(BOOST_DLL_INTERFACE_UNIT) + +namespace boost { namespace dll { + +/// @cond +// We have anonymous namespace here to make sure that `this_line_location()` method is instantiated in +// current translation unit and is not shadowed by instantiations from other units. +// +// boost-no-inspect +namespace { +/// @endcond + +/*! +* On success returns full path and name of the binary object that holds the current line of code +* (the line in which the `this_line_location()` method was called). +* +* \param ec Variable that will be set to the result of the operation. +* \throws std::bad_alloc in case of insufficient memory. Overload that does not accept \forcedlinkfs{error_code} also throws \forcedlinkfs{system_error}. +*/ +static inline boost::dll::fs::path this_line_location(std::error_code& ec) { + typedef boost::dll::fs::path(func_t)(std::error_code& ); + func_t& f = this_line_location; + return boost::dll::symbol_location(f, ec); +} + +//! \overload this_line_location(std::error_code& ec) +static inline boost::dll::fs::path this_line_location() { + boost::dll::fs::path ret; + std::error_code ec; + ret = this_line_location(ec); + + if (ec) { + boost::dll::detail::report_error(ec, "boost::dll::this_line_location() failed"); + } + + return ret; +} + +/// @cond +} // anonymous namespace +/// @endcond + +}} // namespace boost::dll + +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) + #endif // BOOST_DLL_RUNTIME_SYMBOL_INFO_HPP diff --git a/include/boost/dll/shared_library.hpp b/include/boost/dll/shared_library.hpp index da9ee290..3e037f7a 100644 --- a/include/boost/dll/shared_library.hpp +++ b/include/boost/dll/shared_library.hpp @@ -5,17 +5,32 @@ // (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_DLL_SHARED_LIBRARY_HPP -#define BOOST_DLL_SHARED_LIBRARY_HPP - /// \file boost/dll/shared_library.hpp /// \brief Contains the boost::dll::shared_library class, core class for all the /// DLL/DSO operations. +#ifndef BOOST_DLL_SHARED_LIBRARY_HPP +#define BOOST_DLL_SHARED_LIBRARY_HPP + +#include + +#if !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + #include + +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include #include + +#include +#include // std::move +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) + #include #include @@ -25,12 +40,7 @@ # include #endif -#include -#include // std::move - -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif +BOOST_DLL_BEGIN_MODULE_EXPORT namespace boost { namespace dll { @@ -568,4 +578,8 @@ inline void swap(shared_library& lhs, shared_library& rhs) noexcept { }} // boost::dll +BOOST_DLL_END_MODULE_EXPORT + +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + #endif // BOOST_DLL_SHARED_LIBRARY_HPP diff --git a/include/boost/dll/shared_library_load_mode.hpp b/include/boost/dll/shared_library_load_mode.hpp index b02999e5..6bf93410 100644 --- a/include/boost/dll/shared_library_load_mode.hpp +++ b/include/boost/dll/shared_library_load_mode.hpp @@ -5,10 +5,23 @@ // (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) +/// \file boost/dll/shared_library_load_mode.hpp +/// \brief Contains only the boost::dll::load_mode::type enum and operators related to it. + #ifndef BOOST_DLL_SHARED_LIBRARY_MODE_HPP #define BOOST_DLL_SHARED_LIBRARY_MODE_HPP +#include + +#if !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + #include + +#if !defined(BOOST_DLL_INTERFACE_UNIT) #include #include @@ -17,13 +30,9 @@ #else # include #endif +#endif // !defiend(BOOST_DLL_INTERFACE_UNIT) -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -/// \file boost/dll/shared_library_load_mode.hpp -/// \brief Contains only the boost::dll::load_mode::type enum and operators related to it. +BOOST_DLL_BEGIN_MODULE_EXPORT namespace boost { namespace dll { namespace load_mode { @@ -245,4 +254,8 @@ BOOST_CONSTEXPR inline type operator~(type left) noexcept { }}} // boost::dll::load_mode +BOOST_DLL_END_MODULE_EXPORT + +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + #endif // BOOST_DLL_SHARED_LIBRARY_MODE_HPP diff --git a/include/boost/dll/smart_library.hpp b/include/boost/dll/smart_library.hpp index 28b19660..0e047bee 100644 --- a/include/boost/dll/smart_library.hpp +++ b/include/boost/dll/smart_library.hpp @@ -5,33 +5,45 @@ // (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_DLL_SMART_LIBRARY_HPP_ -#define BOOST_DLL_SMART_LIBRARY_HPP_ - /// \file boost/dll/smart_library.hpp /// \warning Experimental feature that relies on an incomplete implementation of platform specific C++ /// mangling. In case of an issue provide a PR with a fix and tests to https://github.com/boostorg/dll . /// boost/dll/smart_library.hpp is not included in boost/dll.hpp /// \brief Contains the boost::dll::experimental::smart_library class for loading mangled symbols. +#ifndef BOOST_DLL_SMART_LIBRARY_HPP_ +#define BOOST_DLL_SMART_LIBRARY_HPP_ + +#include + +#if !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + #include + +#if !defined(BOOST_DLL_INTERFACE_UNIT) +#include +#include // std::move +#endif // !defined(BOOST_DLL_INTERFACE_UNIT) + +#if (__cplusplus < 201103L) && (!defined(_MSVC_LANG) || _MSVC_LANG < 201103L) +# error This file requires C++11 at least! +#endif + #if defined(_MSC_VER) // MSVC, Clang-cl, and ICC on Windows # include #else # include #endif -#if (__cplusplus < 201103L) && (!defined(_MSVC_LANG) || _MSVC_LANG < 201103L) -# error This file requires C++11 at least! -#endif - #include #include #include #include -#include -#include // std::move namespace boost { namespace dll { @@ -40,6 +52,8 @@ namespace experimental { using boost::dll::detail::constructor; using boost::dll::detail::destructor; +BOOST_DLL_BEGIN_MODULE_EXPORT + /*! * \brief This class is an extension of \ref shared_library, which allows to load C++ symbols. * @@ -451,9 +465,13 @@ auto get(const smart_library& sm, const std::string &name) -> typename detail::g return sm.get_mem_fn(name); } +BOOST_DLL_END_MODULE_EXPORT + } /* namespace experimental */ } /* namespace dll */ } /* namespace boost */ +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + #endif /* BOOST_DLL_SMART_LIBRARY_HPP_ */ diff --git a/modules/boost_dll.cppm b/modules/boost_dll.cppm new file mode 100644 index 00000000..30f7a55b --- /dev/null +++ b/modules/boost_dll.cppm @@ -0,0 +1,44 @@ +module; + +#include +#include +#include +#include +#include +#include +#include + +#ifdef BOOST_DLL_USE_STD_FS +# include +# include +#else +# include +# include +# include +# include +#endif + +#if !BOOST_OS_WINDOWS +# include +# include +#endif + +#include +#include +#include + +#ifndef _MSC_VER +#include +#endif + +#define BOOST_DLL_INTERFACE_UNIT + +export module boost.dll; + +#ifdef __clang__ +# pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" +#endif + +#include +#include +#include diff --git a/test/broken_library_info_test.cpp b/test/broken_library_info_test.cpp index b42cacd6..ac59321f 100644 --- a/test/broken_library_info_test.cpp +++ b/test/broken_library_info_test.cpp @@ -6,13 +6,13 @@ // For more information, see http://www.boost.org -#include - #include #include #include +#include + int main(int argc, char* argv[]) { BOOST_TEST(argc >= 1); const auto self_binary = boost::filesystem::path(argv[0]); diff --git a/test/cpp_ctti_type_name_parser_lib.cpp b/test/cpp_ctti_type_name_parser_lib.cpp index eac7f4b2..9a5903bc 100644 --- a/test/cpp_ctti_type_name_parser_lib.cpp +++ b/test/cpp_ctti_type_name_parser_lib.cpp @@ -8,9 +8,10 @@ #include -#include #include +#include + namespace space { template class test_template_class diff --git a/test/cpp_load_test.cpp b/test/cpp_load_test.cpp index f325649b..15078a31 100644 --- a/test/cpp_load_test.cpp +++ b/test/cpp_load_test.cpp @@ -10,8 +10,6 @@ #include #include -# include - #include "../example/b2_workarounds.hpp" #include @@ -20,6 +18,8 @@ #include +#include + struct override_class { int arr[32]; diff --git a/test/cpp_mangle_test.cpp b/test/cpp_mangle_test.cpp index c7eb6142..f9bd1c34 100644 --- a/test/cpp_mangle_test.cpp +++ b/test/cpp_mangle_test.cpp @@ -10,13 +10,13 @@ #include "../example/b2_workarounds.hpp" -#include #include #include #include #include +#include struct override_class {}; @@ -24,7 +24,7 @@ struct override_class {}; int main(int argc, char* argv[]) { using namespace boost::dll; - using mangled_storage = detail::mangled_storage_impl; + using mangled_storage = boost::dll::experimental::smart_library::mangled_storage; boost::dll::fs::path pt = b2_workarounds::first_lib_from_argv(argc, argv); diff --git a/test/cpp_test_library.cpp b/test/cpp_test_library.cpp index fb47ce18..346de5ea 100644 --- a/test/cpp_test_library.cpp +++ b/test/cpp_test_library.cpp @@ -9,7 +9,9 @@ #include -#include +#ifdef BOOST_USE_MODULES +#include +#endif #include BOOST_SYMBOL_EXPORT extern int unscoped_var; diff --git a/test/shared_library_load_test.cpp b/test/shared_library_load_test.cpp index 5bbad70d..e48bb155 100644 --- a/test/shared_library_load_test.cpp +++ b/test/shared_library_load_test.cpp @@ -8,13 +8,14 @@ // For more information, see http://www.boost.org #include "../example/b2_workarounds.hpp" -#include #include #include #include #include + +#include // Unit Tests namespace boost { namespace dll { namespace fs { diff --git a/test/structures_tests.cpp b/test/structures_tests.cpp index ca499bee..6a0638ca 100644 --- a/test/structures_tests.cpp +++ b/test/structures_tests.cpp @@ -7,9 +7,6 @@ // For more information, see http://www.boost.org -#include -#include -#include #include #include @@ -25,6 +22,10 @@ #include #endif +#include +#include +#include + namespace dd = boost::dll::detail; template diff --git a/test/template_method_linux_test.cpp b/test/template_method_linux_test.cpp index d72522cb..e02f12cd 100644 --- a/test/template_method_linux_test.cpp +++ b/test/template_method_linux_test.cpp @@ -7,16 +7,16 @@ #include -#include -#include -#include - #include #include #include "../example/b2_workarounds.hpp" #include +#include +#include +#include + namespace space { class BOOST_SYMBOL_EXPORT my_plugin { diff --git a/test/test_library.cpp b/test/test_library.cpp index 459dd93a..a0f71c30 100644 --- a/test/test_library.cpp +++ b/test/test_library.cpp @@ -11,14 +11,15 @@ // MinGW related workaround #define BOOST_DLL_FORCE_ALIAS_INSTANTIATION -#include -#include #include #include #include #include +#include +#include + #define LIBRARY_API BOOST_SYMBOL_EXPORT extern "C" void LIBRARY_API say_hello(void); From af1c6ac5c7c6012600f6afcb1161f19d67139a02 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 07:30:01 +0000 Subject: [PATCH 13/35] depend each test from its args --- .gitignore | 1 + test/CMakeLists.txt | 63 ++++++++++++++++++++++----------------- test/cpp_test_library.cpp | 1 - 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index 002089cf..0295863d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +.cache build* .vscode diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7b448fe7..9d3fe3e3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -66,7 +66,7 @@ set_target_properties(dll_refcounting_plugin add_dependencies(tests dll_refcounting_plugin) add_library(dll_cpp_plugin SHARED cpp_test_library.cpp) -target_link_libraries(dll_cpp_plugin PRIVATE Boost::dll Boost::variant) +target_link_libraries(dll_cpp_plugin PRIVATE Boost::variant) add_dependencies(tests dll_cpp_plugin) add_library(dll_cpp_mangle_plugin SHARED cpp_ctti_type_name_parser_lib.cpp) @@ -77,32 +77,39 @@ function(boost_dll_add_test name sources export_symbols) add_executable(${name} ${sources}) set_target_properties(${name} PROPERTIES ENABLE_EXPORTS ${export_symbols}) target_link_libraries(${name} PRIVATE Boost::dll Boost::filesystem) - add_test(NAME ${name} COMMAND ${name} ${ARGN}) + + set(test_args) + foreach(lib IN LISTS ARGN) + list(APPEND test_args "$") + endforeach() + add_test(NAME ${name} COMMAND ${name} ${test_args}) + + add_dependencies(${name} ${ARGN}) add_dependencies(tests ${name}) endfunction() # Examples -boost_dll_add_test(dll_example_getting_started ../example/getting_started.cpp #[[export_symbols=]] FALSE "$") +boost_dll_add_test(dll_example_getting_started ../example/getting_started.cpp #[[export_symbols=]] FALSE dll_getting_started_library) -boost_dll_add_test(dll_example_tutorial1_std_shared_ptr ../example/tutorial1/tutorial1.cpp #[[export_symbols=]] FALSE "$") -boost_dll_add_test(dll_example_tutorial1_boost_shared_ptr ../example/tutorial1/tutorial1.cpp #[[export_symbols=]] FALSE "$") +boost_dll_add_test(dll_example_tutorial1_std_shared_ptr ../example/tutorial1/tutorial1.cpp #[[export_symbols=]] FALSE dll_my_plugin_sum) +boost_dll_add_test(dll_example_tutorial1_boost_shared_ptr ../example/tutorial1/tutorial1.cpp #[[export_symbols=]] FALSE dll_my_plugin_sum) -boost_dll_add_test(dll_example_tutorial2 ../example/tutorial2/tutorial2.cpp #[[export_symbols=]] FALSE "$") +boost_dll_add_test(dll_example_tutorial2 ../example/tutorial2/tutorial2.cpp #[[export_symbols=]] FALSE dll_my_plugin_aggregator) -boost_dll_add_test(dll_example_tutorial3 ../example/tutorial3/tutorial3.cpp #[[export_symbols=]] FALSE "$" "$") +boost_dll_add_test(dll_example_tutorial3 ../example/tutorial3/tutorial3.cpp #[[export_symbols=]] FALSE dll_my_plugin_sum dll_my_plugin_aggregator) boost_dll_add_test(dll_example_tutorial4 ../example/tutorial4/load_self.cpp #[[export_symbols=]] TRUE) target_link_libraries(dll_example_tutorial4 PRIVATE dll_static_plugin) -boost_dll_add_test(dll_example_tutorial5 ../example/tutorial5/load_all.cpp #[[export_symbols=]] TRUE "$" "$" "$") +boost_dll_add_test(dll_example_tutorial5 ../example/tutorial5/load_all.cpp #[[export_symbols=]] TRUE dll_getting_started_library dll_my_plugin_aggregator dll_my_plugin_sum) target_link_libraries(dll_example_tutorial5 PRIVATE dll_static_plugin) -boost_dll_add_test(dll_example_tutorial6 ../example/tutorial6/tutorial6.cpp #[[export_symbols=]] FALSE "$") +boost_dll_add_test(dll_example_tutorial6 ../example/tutorial6/tutorial6.cpp #[[export_symbols=]] FALSE dll_on_unload_lib) -boost_dll_add_test(dll_example_tutorial7 ../example/tutorial7/tutorial7.cpp #[[export_symbols=]] FALSE "$" "$") +boost_dll_add_test(dll_example_tutorial7 ../example/tutorial7/tutorial7.cpp #[[export_symbols=]] FALSE dll_library1 dll_library2) -boost_dll_add_test(dll_example_tutorial8 ../example/tutorial8/tutorial8.cpp #[[export_symbols=]] FALSE "$") +boost_dll_add_test(dll_example_tutorial8 ../example/tutorial8/tutorial8.cpp #[[export_symbols=]] FALSE dll_refcounting_plugin) boost_dll_add_test(dll_example_tutorial8_static ../example/tutorial8/tutorial8_static.cpp #[[export_symbols=]] TRUE) target_link_libraries(dll_example_tutorial8_static PRIVATE dll_static_refcounting_plugin) @@ -115,31 +122,31 @@ target_link_libraries(dll_test_link PRIVATE Boost::dll) boost_dll_add_test(dll_test_structures structures_tests.cpp #[[export_symbols=]] FALSE) boost_dll_add_test(dll_test_cpp_mangling cpp_mangling.cpp #[[export_symbols=]] FALSE) -boost_dll_add_test(dll_test_cpp_mangle cpp_mangle_test.cpp #[[export_symbols=]] FALSE "$") +boost_dll_add_test(dll_test_cpp_mangle cpp_mangle_test.cpp #[[export_symbols=]] FALSE dll_cpp_plugin) target_link_libraries(dll_test_cpp_mangle PRIVATE Boost::variant) -boost_dll_add_test(dll_test_cpp_load cpp_load_test.cpp #[[export_symbols=]] FALSE "$") +boost_dll_add_test(dll_test_cpp_load cpp_load_test.cpp #[[export_symbols=]] FALSE dll_cpp_plugin) target_link_libraries(dll_test_cpp_load PRIVATE Boost::variant) -boost_dll_add_test(dll_test_cpp_import cpp_import_test.cpp #[[export_symbols=]] FALSE "$") +boost_dll_add_test(dll_test_cpp_import cpp_import_test.cpp #[[export_symbols=]] FALSE dll_cpp_plugin) target_link_libraries(dll_test_cpp_import PRIVATE Boost::variant) if(LINUX) - boost_dll_add_test(dll_test_cpp_template_method_linux template_method_linux_test.cpp #[[export_symbols=]] FALSE "$") + boost_dll_add_test(dll_test_cpp_template_method_linux template_method_linux_test.cpp #[[export_symbols=]] FALSE dll_cpp_plugin) endif() if(LINUX AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - boost_dll_add_test(dll_test_ctti_type_name_parser ctti_type_name_parser_test.cpp #[[export_symbols=]] FALSE "$") + boost_dll_add_test(dll_test_ctti_type_name_parser ctti_type_name_parser_test.cpp #[[export_symbols=]] FALSE dll_cpp_mangle_plugin) target_link_libraries(dll_test_ctti_type_name_parser PRIVATE Boost::variant) endif() -boost_dll_add_test(dll_test_shared_library_load shared_library_load_test.cpp #[[export_symbols=]] FALSE "$" "$") -boost_dll_add_test(dll_test_shared_library_search_symbol shared_library_search_symbol_test.cpp #[[export_symbols=]] TRUE "$") -boost_dll_add_test(dll_test_shared_library_get_symbol shared_library_get_symbol_test.cpp #[[export_symbols=]] TRUE "$") -boost_dll_add_test(dll_test_symbol_runtime_info symbol_runtime_info_test.cpp #[[export_symbols=]] TRUE "$") -boost_dll_add_test(dll_test_shared_library_errors shared_library_errors.cpp #[[export_symbols=]] FALSE "$") -boost_dll_add_test(dll_test_library_info library_info_test.cpp #[[export_symbols=]] FALSE "$") +boost_dll_add_test(dll_test_shared_library_load shared_library_load_test.cpp #[[export_symbols=]] FALSE dll_test_library dll_library1) +boost_dll_add_test(dll_test_shared_library_search_symbol shared_library_search_symbol_test.cpp #[[export_symbols=]] TRUE dll_test_library) +boost_dll_add_test(dll_test_shared_library_get_symbol shared_library_get_symbol_test.cpp #[[export_symbols=]] TRUE dll_test_library) +boost_dll_add_test(dll_test_symbol_runtime_info symbol_runtime_info_test.cpp #[[export_symbols=]] TRUE dll_test_library) +boost_dll_add_test(dll_test_shared_library_errors shared_library_errors.cpp #[[export_symbols=]] FALSE dll_test_library) +boost_dll_add_test(dll_test_library_info library_info_test.cpp #[[export_symbols=]] FALSE dll_test_library) target_link_libraries(dll_test_library_info PRIVATE dll_static_plugin) -boost_dll_add_test(dll_test_broken_library_info broken_library_info_test.cpp #[[export_symbols=]] FALSE "$") -boost_dll_add_test(dll_test_empty_library_info empty_library_info_test.cpp #[[export_symbols=]] FALSE "$") +boost_dll_add_test(dll_test_broken_library_info broken_library_info_test.cpp #[[export_symbols=]] FALSE dll_test_library) +boost_dll_add_test(dll_test_empty_library_info empty_library_info_test.cpp #[[export_symbols=]] FALSE dll_empty_library) boost_dll_add_test(dll_test_shared_library_concurrent_load shared_library_concurrent_load_test.cpp #[[export_symbols=]] FALSE - "$" - "$" - "$" - "$" + dll_library1 + dll_library2 + dll_my_plugin_aggregator + dll_refcounting_plugin ) diff --git a/test/cpp_test_library.cpp b/test/cpp_test_library.cpp index fb47ce18..3a694465 100644 --- a/test/cpp_test_library.cpp +++ b/test/cpp_test_library.cpp @@ -9,7 +9,6 @@ #include -#include #include BOOST_SYMBOL_EXPORT extern int unscoped_var; From dfc4653a49802302e42e86f5e85566d689addff8 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 07:40:59 +0000 Subject: [PATCH 14/35] fix build with std::filesystem --- modules/boost_dll.cppm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/boost_dll.cppm b/modules/boost_dll.cppm index 30f7a55b..fdbf4d80 100644 --- a/modules/boost_dll.cppm +++ b/modules/boost_dll.cppm @@ -1,7 +1,7 @@ module; #include -#include +#include #include #include #include @@ -40,5 +40,8 @@ export module boost.dll; #endif #include + +// Experimental features #include #include +#include From aa2e1963584927d5cf206b6ac59c53631f6b8094 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 07:44:29 +0000 Subject: [PATCH 15/35] remove redundant add_dependencies, fix no args add_dependencies --- test/CMakeLists.txt | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9d3fe3e3..d2edbc00 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -12,22 +12,17 @@ endif() add_library(dll_static_plugin STATIC ../example/tutorial4/static_plugin.cpp) target_link_libraries(dll_static_plugin PRIVATE Boost::dll) -add_dependencies(tests dll_static_plugin) add_library(dll_static_refcounting_plugin STATIC ../example/tutorial8/refcounting_plugin.cpp) target_link_libraries(dll_static_refcounting_plugin PRIVATE Boost::dll) -add_dependencies(tests dll_static_refcounting_plugin) add_library(dll_test_library SHARED test_library.cpp) target_link_libraries(dll_test_library PRIVATE Boost::dll Boost::fusion) -add_dependencies(tests dll_test_library) add_library(dll_empty_library SHARED empty_library.cpp) -add_dependencies(tests dll_empty_library) add_library(dll_getting_started_library SHARED ../example/getting_started_library.cpp) target_link_libraries(dll_getting_started_library PRIVATE Boost::dll) -add_dependencies(tests dll_getting_started_library) add_library(dll_my_plugin_sum SHARED ../example/tutorial1/my_plugin_sum.cpp) target_link_libraries(dll_my_plugin_sum PRIVATE Boost::dll) @@ -35,7 +30,6 @@ set_target_properties(dll_my_plugin_sum PROPERTIES OUTPUT_NAME "my_plugin_sum" ) -add_dependencies(tests dll_my_plugin_sum) add_library(dll_my_plugin_aggregator SHARED ../example/tutorial2/my_plugin_aggregator.cpp) target_link_libraries(dll_my_plugin_aggregator PRIVATE Boost::dll) @@ -43,19 +37,15 @@ set_target_properties(dll_my_plugin_aggregator PROPERTIES OUTPUT_NAME "my_plugin_aggregator" ) -add_dependencies(tests dll_my_plugin_aggregator) add_library(dll_on_unload_lib SHARED ../example/tutorial6/on_unload_lib.cpp) target_link_libraries(dll_on_unload_lib PRIVATE Boost::dll) -add_dependencies(tests dll_on_unload_lib) add_library(dll_library1 SHARED ../example/tutorial7/library1.cpp) target_link_libraries(dll_library1 PRIVATE Boost::dll) -add_dependencies(tests dll_library1) add_library(dll_library2 SHARED ../example/tutorial7/library2.cpp) target_link_libraries(dll_library2 PRIVATE Boost::dll) -add_dependencies(tests dll_library2) add_library(dll_refcounting_plugin SHARED ../example/tutorial8/refcounting_plugin.cpp) target_link_libraries(dll_refcounting_plugin PRIVATE Boost::dll) @@ -63,15 +53,12 @@ set_target_properties(dll_refcounting_plugin PROPERTIES OUTPUT_NAME "refcounting_plugin" ) -add_dependencies(tests dll_refcounting_plugin) add_library(dll_cpp_plugin SHARED cpp_test_library.cpp) target_link_libraries(dll_cpp_plugin PRIVATE Boost::variant) -add_dependencies(tests dll_cpp_plugin) add_library(dll_cpp_mangle_plugin SHARED cpp_ctti_type_name_parser_lib.cpp) target_link_libraries(dll_cpp_mangle_plugin PRIVATE Boost::dll) -add_dependencies(tests dll_cpp_mangle_plugin) function(boost_dll_add_test name sources export_symbols) add_executable(${name} ${sources}) @@ -84,7 +71,9 @@ function(boost_dll_add_test name sources export_symbols) endforeach() add_test(NAME ${name} COMMAND ${name} ${test_args}) - add_dependencies(${name} ${ARGN}) + if(ARGN) + add_dependencies(${name} ${ARGN}) + endif() add_dependencies(tests ${name}) endfunction() From c74cb789706934bf3c73a333444c823f94848ba1 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 07:46:43 +0000 Subject: [PATCH 16/35] add modules tests to CI --- .github/workflows/ci.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d098f17a..d119ee7a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,6 +105,22 @@ jobs: ./b2 -d0 headers ./b2 -j4 variant=debug tools/inspect + - name: Run modules tests without 'import std;' + if: ${{matrix.toolset == 'clang-19'}} + run: | + cd ../boost-root/libs/$LIBRARY + cmake -S test/cmake_subdir_test -B __build \ + -GNinja \ + -DBUILD_TESTING=1 \ + -DBOOST_DLL_USE_STD_FS=1 \ + -DBOOST_USE_MODULES=1 \ + -DCMAKE_CXX_COMPILER=${{matrix.compiler}} \ + -DCMAKE_CXX_FLAGS="-stdlib=libc++" + + cmake --build __build + ctest --test-dir __build --output-on-failure --no-tests=error -VV + rm -rf __build + - name: Run CMake subdir tests if: ${{matrix.toolset == 'gcc-14' || matrix.toolset == 'clang-19'}} run: | From eff8c4b73622b73b504ea7b6eef86e820f3d5b99 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 07:53:49 +0000 Subject: [PATCH 17/35] fix boost_shared_ptr test --- test/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d2edbc00..1bd2f2aa 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -83,6 +83,7 @@ boost_dll_add_test(dll_example_getting_started ../example/getting_started.cpp #[ boost_dll_add_test(dll_example_tutorial1_std_shared_ptr ../example/tutorial1/tutorial1.cpp #[[export_symbols=]] FALSE dll_my_plugin_sum) boost_dll_add_test(dll_example_tutorial1_boost_shared_ptr ../example/tutorial1/tutorial1.cpp #[[export_symbols=]] FALSE dll_my_plugin_sum) +target_compile_definitions(dll_example_tutorial1_boost_shared_ptr PRIVATE BOOST_DLL_USE_BOOST_SHARED_PTR) boost_dll_add_test(dll_example_tutorial2 ../example/tutorial2/tutorial2.cpp #[[export_symbols=]] FALSE dll_my_plugin_aggregator) From a6329e2738d2d415dc4feb7d19211bab9232fa81 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 07:57:52 +0000 Subject: [PATCH 18/35] add copyright --- CMakeLists.txt | 1 + include/boost/dll/detail/config.hpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e67039d..0540476f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ # Copyright 2020 Peter Dimov # Copyright Antony Polukhin, 2021-2026 +# Copyright Fedor Osetrov, 2025-2026 # # Distributed under the Boost Software License, Version 1.0. # https://www.boost.org/LICENSE_1_0.txt diff --git a/include/boost/dll/detail/config.hpp b/include/boost/dll/detail/config.hpp index a3fa1dd7..f9c44f23 100644 --- a/include/boost/dll/detail/config.hpp +++ b/include/boost/dll/detail/config.hpp @@ -1,3 +1,9 @@ +// Copyright Fedor Osetrov, 2025-2026. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + #ifndef BOOST_DLL_DETAIL_CONFIG_HPP #define BOOST_DLL_DETAIL_CONFIG_HPP From e99a58733738d9eabf889a0256bbfb4c90381ba7 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 08:56:43 +0000 Subject: [PATCH 19/35] add module usage sample --- modules/boost_dll.cppm | 7 +++++ modules/sample_plugin.cpp | 42 +++++++++++++++++++++++++++ modules/sample_plugin.cppm | 18 ++++++++++++ modules/usage_sample.cpp | 26 +++++++++++++++++ test/cmake_subdir_test/CMakeLists.txt | 19 ++++++++++++ 5 files changed, 112 insertions(+) create mode 100644 modules/sample_plugin.cpp create mode 100644 modules/sample_plugin.cppm create mode 100644 modules/usage_sample.cpp diff --git a/modules/boost_dll.cppm b/modules/boost_dll.cppm index fdbf4d80..ebe7b5a7 100644 --- a/modules/boost_dll.cppm +++ b/modules/boost_dll.cppm @@ -1,3 +1,10 @@ +// Copyright Antony Polukhin, 2025-2026. +// Copyright Fedor Osetrov, 2025-2026. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + module; #include diff --git a/modules/sample_plugin.cpp b/modules/sample_plugin.cpp new file mode 100644 index 00000000..ad08eb07 --- /dev/null +++ b/modules/sample_plugin.cpp @@ -0,0 +1,42 @@ +// Copyright Antony Polukhin, 2025-2026. +// Copyright Fedor Osetrov, 2025-2026. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + +module; + +#include +#include + +#include "../example/tutorial_common/my_plugin_api.hpp" + +module sample_plugin; + +namespace my_namespace { + +class my_module_plugin final : public my_plugin_api { +public: + my_module_plugin() { + std::cout << "Constructing my_module_plugin" << std::endl; + } + + std::string name() const override { + return "module_plugin"; + } + + float calculate(float x, float y) override { + return x - y; + } + + ~my_module_plugin() { + std::cout << "Destructing my_module_plugin" << std::endl; + } +}; + +std::shared_ptr create_plugin() { + return std::make_shared(); +} + +} // namespace my_namespace diff --git a/modules/sample_plugin.cppm b/modules/sample_plugin.cppm new file mode 100644 index 00000000..3f906268 --- /dev/null +++ b/modules/sample_plugin.cppm @@ -0,0 +1,18 @@ +// Copyright Antony Polukhin, 2025-2026. +// Copyright Fedor Osetrov, 2025-2026. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + +module; + +#include "../example/tutorial_common/my_plugin_api.hpp" + +export module sample_plugin; + +namespace my_namespace { + std::shared_ptr create_plugin(); +} // namespace my_namespace + + diff --git a/modules/usage_sample.cpp b/modules/usage_sample.cpp new file mode 100644 index 00000000..c6a56f04 --- /dev/null +++ b/modules/usage_sample.cpp @@ -0,0 +1,26 @@ +// Copyright Antony Polukhin, 2025-2026. +// Copyright Fedor Osetrov, 2025-2026. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include + +#include "../example/tutorial_common/my_plugin_api.hpp" + +import boost.dll; + +int main(int argc, const char* const argv[]) { + namespace dll = boost::dll::experimental; + + dll::smart_library module_library(argv[1]); + + auto creator = module_library.get_function()>("my_namespace::create_plugin@sample_plugin"); + + const float res = creator()->calculate(10, 8.5); + std::cout << "Result: " << res << '\n'; + + return 0; +} diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt index 24ed058d..9b16251b 100644 --- a/test/cmake_subdir_test/CMakeLists.txt +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -59,3 +59,22 @@ endforeach() enable_testing() add_subdirectory(../.. boostorg/dll) + +if(BOOST_USE_MODULES) + add_library(dll_sample_plugin_module SHARED) + target_link_libraries(dll_sample_plugin_module PUBLIC Boost::config) + target_sources(dll_sample_plugin_module + PUBLIC + FILE_SET CXX_MODULES + BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../../modules + FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../modules/sample_plugin.cppm + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/../../modules/sample_plugin.cpp + ) + + add_executable(boost_dll_module_usage ../../modules/usage_sample.cpp) + target_link_libraries(boost_dll_module_usage PRIVATE Boost::dll) + add_test(NAME boost_dll_module_usage COMMAND boost_dll_module_usage "$") + add_dependencies(boost_dll_module_usage dll_sample_plugin_module) + +endif() From 9c4c525430e7b4d49da8ec2c824f2ac5a460a683 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 09:25:39 +0000 Subject: [PATCH 20/35] fix typos --- modules/sample_plugin.cppm | 2 -- test/cmake_subdir_test/CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/sample_plugin.cppm b/modules/sample_plugin.cppm index 3f906268..4dd2b25b 100644 --- a/modules/sample_plugin.cppm +++ b/modules/sample_plugin.cppm @@ -14,5 +14,3 @@ export module sample_plugin; namespace my_namespace { std::shared_ptr create_plugin(); } // namespace my_namespace - - diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt index 9b16251b..3a085065 100644 --- a/test/cmake_subdir_test/CMakeLists.txt +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -62,7 +62,7 @@ add_subdirectory(../.. boostorg/dll) if(BOOST_USE_MODULES) add_library(dll_sample_plugin_module SHARED) - target_link_libraries(dll_sample_plugin_module PUBLIC Boost::config) + target_link_libraries(dll_sample_plugin_module PRIVATE Boost::config) target_sources(dll_sample_plugin_module PUBLIC FILE_SET CXX_MODULES From 80c4521eee9b352477a8ff4b28fe10ff934a4655 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 09:31:10 +0000 Subject: [PATCH 21/35] rollback strange rename --- include/boost/dll/detail/posix/shared_library_impl.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/dll/detail/posix/shared_library_impl.hpp b/include/boost/dll/detail/posix/shared_library_impl.hpp index 11753e8b..e7e5568e 100644 --- a/include/boost/dll/detail/posix/shared_library_impl.hpp +++ b/include/boost/dll/detail/posix/shared_library_impl.hpp @@ -126,8 +126,8 @@ class shared_library_impl { return; } boost::dll::fs::error_code prog_loc_err; - boost::dll::fs::path l = boost::dll::detail::program_location_impl(prog_loc_err); - if (boost::dll::fs::exists(actual_path) && !boost::dll::fs::equivalent(sl, l, prog_loc_err)) { + boost::dll::fs::path loc = boost::dll::detail::program_location_impl(prog_loc_err); + if (boost::dll::fs::exists(actual_path) && !boost::dll::fs::equivalent(sl, loc, prog_loc_err)) { // decorated path exists : current error is not a bad file descriptor and we are not trying to load the executable itself ec = std::make_error_code( std::errc::executable_format_error From cda1667c6b2728f731ebf96198d1224258ace444 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 09:38:24 +0000 Subject: [PATCH 22/35] better --- include/boost/dll/import.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/dll/import.hpp b/include/boost/dll/import.hpp index 8817b488..b98dfcce 100644 --- a/include/boost/dll/import.hpp +++ b/include/boost/dll/import.hpp @@ -258,10 +258,10 @@ BOOST_DLL_IMPORT_RESULT_TYPE import_alias(shared_library&& lib, const std::strin return dll::import_alias(std::move(lib), name.c_str()); } -#undef BOOST_DLL_IMPORT_RESULT_TYPE - BOOST_DLL_END_MODULE_EXPORT +#undef BOOST_DLL_IMPORT_RESULT_TYPE + }} // boost::dll #endif // !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) From 1d91f310029bbd360836b484dd3076ce635fb5c7 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 09:44:16 +0000 Subject: [PATCH 23/35] better --- include/boost/dll/config.hpp | 4 ---- modules/sample_plugin.cppm | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/include/boost/dll/config.hpp b/include/boost/dll/config.hpp index 6631287a..a55a464f 100644 --- a/include/boost/dll/config.hpp +++ b/include/boost/dll/config.hpp @@ -53,11 +53,9 @@ using system_error = std::conditional_t #endif // !defined(BOOST_DLL_INTERFACE_UNIT) -BOOST_DLL_BEGIN_MODULE_EXPORT namespace boost { namespace dll { namespace fs { using namespace boost::filesystem; @@ -78,7 +75,6 @@ using boost::system::error_code; using boost::system::system_error; }}} -BOOST_DLL_END_MODULE_EXPORT #endif // BOOST_DLL_USE_STD_FS diff --git a/modules/sample_plugin.cppm b/modules/sample_plugin.cppm index 4dd2b25b..2d86b52c 100644 --- a/modules/sample_plugin.cppm +++ b/modules/sample_plugin.cppm @@ -12,5 +12,5 @@ module; export module sample_plugin; namespace my_namespace { - std::shared_ptr create_plugin(); + export std::shared_ptr create_plugin(); } // namespace my_namespace From c33e508f99919db44ee4889c920eac496fa55d7f Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 09:45:09 +0000 Subject: [PATCH 24/35] better --- modules/usage_sample.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/usage_sample.cpp b/modules/usage_sample.cpp index c6a56f04..5ec605ae 100644 --- a/modules/usage_sample.cpp +++ b/modules/usage_sample.cpp @@ -6,7 +6,6 @@ // or copy at http://www.boost.org/LICENSE_1_0.txt) #include -#include #include "../example/tutorial_common/my_plugin_api.hpp" From 19b49e9f851b415c2dd30564d097867f80bec8ef Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 09:52:58 +0000 Subject: [PATCH 25/35] fix modules CI --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d119ee7a..8e512106 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,7 +115,8 @@ jobs: -DBOOST_DLL_USE_STD_FS=1 \ -DBOOST_USE_MODULES=1 \ -DCMAKE_CXX_COMPILER=${{matrix.compiler}} \ - -DCMAKE_CXX_FLAGS="-stdlib=libc++" + -DCMAKE_CXX_FLAGS="-stdlib=libc++" \ + -DCMAKE_CXX_STANDARD=20 cmake --build __build ctest --test-dir __build --output-on-failure --no-tests=error -VV From c004678180d5ad962fdeaf5b20cd11885d9120d1 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 09:58:34 +0000 Subject: [PATCH 26/35] use headers file set --- modules/sample_plugin.cpp | 2 +- modules/sample_plugin.cppm | 2 +- test/cmake_subdir_test/CMakeLists.txt | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/sample_plugin.cpp b/modules/sample_plugin.cpp index ad08eb07..14e17857 100644 --- a/modules/sample_plugin.cpp +++ b/modules/sample_plugin.cpp @@ -10,7 +10,7 @@ module; #include #include -#include "../example/tutorial_common/my_plugin_api.hpp" +#include module sample_plugin; diff --git a/modules/sample_plugin.cppm b/modules/sample_plugin.cppm index 2d86b52c..78073a33 100644 --- a/modules/sample_plugin.cppm +++ b/modules/sample_plugin.cppm @@ -7,7 +7,7 @@ module; -#include "../example/tutorial_common/my_plugin_api.hpp" +#include export module sample_plugin; diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt index 3a085065..7fc41094 100644 --- a/test/cmake_subdir_test/CMakeLists.txt +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -68,6 +68,10 @@ if(BOOST_USE_MODULES) FILE_SET CXX_MODULES BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../../modules FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../modules/sample_plugin.cppm + PUBLIC + FILE_SET HEADERS + BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../../example/tutorial_common + FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../example/tutorial_common/my_plugin_api.hpp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../modules/sample_plugin.cpp ) From 320b3e6aca6d92c41c79bdbe0bba4604c71302f8 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 10:46:07 +0000 Subject: [PATCH 27/35] add missing include --- include/boost/dll/detail/system_error.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/boost/dll/detail/system_error.hpp b/include/boost/dll/detail/system_error.hpp index d024fd6c..4a7765b6 100644 --- a/include/boost/dll/detail/system_error.hpp +++ b/include/boost/dll/detail/system_error.hpp @@ -21,6 +21,9 @@ #if !BOOST_OS_WINDOWS # include #endif + +#include + #endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { From f14cee46a05eff058ad0893ff63b1c3369c1a4ae Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 10:50:34 +0000 Subject: [PATCH 28/35] remove strange includes --- include/boost/dll/runtime_symbol_info.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/boost/dll/runtime_symbol_info.hpp b/include/boost/dll/runtime_symbol_info.hpp index 71db1135..0439e347 100644 --- a/include/boost/dll/runtime_symbol_info.hpp +++ b/include/boost/dll/runtime_symbol_info.hpp @@ -13,11 +13,10 @@ #include -#include -#include - #if !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) +#include + #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif @@ -237,6 +236,8 @@ BOOST_DLL_END_MODULE_EXPORT #if !defined(BOOST_DLL_INTERFACE_UNIT) +#include + namespace boost { namespace dll { /// @cond From 943a95adfc85a39b031eca8722283c3f2d8b991c Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 10:54:11 +0000 Subject: [PATCH 29/35] use report error from module in this_line_location --- include/boost/dll/detail/system_error.hpp | 10 ++++++++++ include/boost/dll/runtime_symbol_info.hpp | 1 + 2 files changed, 11 insertions(+) diff --git a/include/boost/dll/detail/system_error.hpp b/include/boost/dll/detail/system_error.hpp index 4a7765b6..ba7418d5 100644 --- a/include/boost/dll/detail/system_error.hpp +++ b/include/boost/dll/detail/system_error.hpp @@ -8,6 +8,10 @@ #ifndef BOOST_DLL_SYSTEM_ERROR_HPP #define BOOST_DLL_SYSTEM_ERROR_HPP +#include + +#if !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif @@ -26,6 +30,8 @@ #endif // !defined(BOOST_DLL_INTERFACE_UNIT) +BOOST_DLL_BEGIN_MODULE_EXPORT + namespace boost { namespace dll { namespace detail { inline void reset_dlerror() noexcept { @@ -57,5 +63,9 @@ namespace boost { namespace dll { namespace detail { }}} // boost::dll::detail +BOOST_DLL_END_MODULE_EXPORT + +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT) + #endif // BOOST_DLL_SYSTEM_ERROR_HPP diff --git a/include/boost/dll/runtime_symbol_info.hpp b/include/boost/dll/runtime_symbol_info.hpp index 0439e347..74e17947 100644 --- a/include/boost/dll/runtime_symbol_info.hpp +++ b/include/boost/dll/runtime_symbol_info.hpp @@ -236,6 +236,7 @@ BOOST_DLL_END_MODULE_EXPORT #if !defined(BOOST_DLL_INTERFACE_UNIT) +#include #include namespace boost { namespace dll { From 966f698517f9cfb642cd958096219ad5cb7ef1f7 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 11:37:20 +0000 Subject: [PATCH 30/35] import std support --- CMakeLists.txt | 13 ++++++++++++- include/boost/dll/config.hpp | 4 ++++ include/boost/dll/detail/aggressive_ptr_cast.hpp | 2 ++ .../boost/dll/detail/demangling/demangle_symbol.hpp | 2 ++ include/boost/dll/detail/demangling/itanium.hpp | 2 ++ .../dll/detail/demangling/mangled_storage_base.hpp | 2 ++ include/boost/dll/detail/demangling/msvc.hpp | 2 ++ include/boost/dll/detail/elf_info.hpp | 2 ++ include/boost/dll/detail/import_mangled_helpers.hpp | 2 ++ include/boost/dll/detail/macho_info.hpp | 2 ++ include/boost/dll/detail/pe_info.hpp | 2 ++ include/boost/dll/detail/posix/path_from_handle.hpp | 2 ++ .../dll/detail/posix/program_location_impl.hpp | 10 +++++++++- .../boost/dll/detail/posix/shared_library_impl.hpp | 4 +++- include/boost/dll/detail/system_error.hpp | 2 ++ include/boost/dll/detail/type_info.hpp | 2 ++ .../dll/detail/windows/shared_library_impl.hpp | 2 ++ include/boost/dll/import.hpp | 2 ++ include/boost/dll/import_class.hpp | 2 ++ include/boost/dll/import_mangled.hpp | 3 ++- include/boost/dll/library_info.hpp | 2 ++ include/boost/dll/runtime_symbol_info.hpp | 2 ++ include/boost/dll/shared_library.hpp | 2 ++ include/boost/dll/smart_library.hpp | 2 ++ modules/boost_dll.cppm | 9 +++++++++ modules/sample_plugin.cppm | 2 ++ 26 files changed, 79 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0540476f..e886f23d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,18 @@ target_link_libraries(boost_dll_boost_fs if (BOOST_USE_MODULES) add_library(boost_dll) target_compile_definitions(boost_dll PUBLIC BOOST_USE_MODULES) - target_compile_features(boost_dll PUBLIC cxx_std_20) + + get_property(__standard TARGET boost_dll PROPERTY CXX_STANDARD) + if (__standard IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD AND CMAKE_CXX_MODULE_STD) + target_compile_features(boost_dll PUBLIC cxx_std_23) + target_compile_definitions(boost_dll PRIVATE BOOST_DLL_USE_STD_MODULE) + message(STATUS "Using `import std;`") + else() + target_compile_features(boost_dll PUBLIC cxx_std_20) + message(STATUS "`import std;` is not available") + endif() + unset(__standard) + target_sources(boost_dll PUBLIC FILE_SET CXX_MODULES diff --git a/include/boost/dll/config.hpp b/include/boost/dll/config.hpp index a55a464f..67c97d9a 100644 --- a/include/boost/dll/config.hpp +++ b/include/boost/dll/config.hpp @@ -47,8 +47,10 @@ using system_error = std::conditional_t #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace fs { @@ -94,7 +96,9 @@ namespace boost { namespace dll { namespace detail { #else // BOOST_DLL_USE_STD_FS #if !defined(BOOST_DLL_INTERFACE_UNIT) +#if !defined(BOOST_DLL_USE_STD_MODULE) #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { diff --git a/include/boost/dll/detail/aggressive_ptr_cast.hpp b/include/boost/dll/detail/aggressive_ptr_cast.hpp index e50cc8da..a53e5669 100644 --- a/include/boost/dll/detail/aggressive_ptr_cast.hpp +++ b/include/boost/dll/detail/aggressive_ptr_cast.hpp @@ -14,9 +14,11 @@ #endif #if !defined(BOOST_DLL_INTERFACE_UNIT) +#if !defined(BOOST_DLL_USE_STD_MODULE) #include // std::memcpy #include #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) #if defined(__GNUC__) && defined(__GNUC_MINOR__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 301) diff --git a/include/boost/dll/detail/demangling/demangle_symbol.hpp b/include/boost/dll/detail/demangling/demangle_symbol.hpp index 5a1599af..c29cbb63 100644 --- a/include/boost/dll/detail/demangling/demangle_symbol.hpp +++ b/include/boost/dll/detail/demangling/demangle_symbol.hpp @@ -11,9 +11,11 @@ #include #if !defined(BOOST_DLL_INTERFACE_UNIT) +#if !defined(BOOST_DLL_USE_STD_MODULE) #include #include #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) #if defined(_MSC_VER) // MSVC, Clang-cl, and ICC on Windows diff --git a/include/boost/dll/detail/demangling/itanium.hpp b/include/boost/dll/detail/demangling/itanium.hpp index b08ed38d..de20fc07 100644 --- a/include/boost/dll/detail/demangling/itanium.hpp +++ b/include/boost/dll/detail/demangling/itanium.hpp @@ -8,9 +8,11 @@ #define BOOST_DLL_DETAIL_DEMANGLING_ITANIUM_HPP_ #if !defined(BOOST_DLL_INTERFACE_UNIT) +#if !defined(BOOST_DLL_USE_STD_MODULE) #include #include #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) #include diff --git a/include/boost/dll/detail/demangling/mangled_storage_base.hpp b/include/boost/dll/detail/demangling/mangled_storage_base.hpp index b072a9b2..38a59319 100644 --- a/include/boost/dll/detail/demangling/mangled_storage_base.hpp +++ b/include/boost/dll/detail/demangling/mangled_storage_base.hpp @@ -10,10 +10,12 @@ #if !defined(BOOST_DLL_INTERFACE_UNIT) #include +#if !defined(BOOST_DLL_USE_STD_MODULE) #include #include #include #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) #include diff --git a/include/boost/dll/detail/demangling/msvc.hpp b/include/boost/dll/detail/demangling/msvc.hpp index 47740a12..1530f210 100644 --- a/include/boost/dll/detail/demangling/msvc.hpp +++ b/include/boost/dll/detail/demangling/msvc.hpp @@ -10,9 +10,11 @@ #if !defined(BOOST_DLL_INTERFACE_UNIT) #include +#if !defined(BOOST_DLL_USE_STD_MODULE) #include #include #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) #include diff --git a/include/boost/dll/detail/elf_info.hpp b/include/boost/dll/detail/elf_info.hpp index 363ce55b..beedf0fe 100644 --- a/include/boost/dll/detail/elf_info.hpp +++ b/include/boost/dll/detail/elf_info.hpp @@ -17,10 +17,12 @@ #if !defined(BOOST_DLL_INTERFACE_UNIT) #include +#if !defined(BOOST_DLL_USE_STD_MODULE) #include #include #include #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { diff --git a/include/boost/dll/detail/import_mangled_helpers.hpp b/include/boost/dll/detail/import_mangled_helpers.hpp index b7f7353e..33fc6489 100644 --- a/include/boost/dll/detail/import_mangled_helpers.hpp +++ b/include/boost/dll/detail/import_mangled_helpers.hpp @@ -13,7 +13,9 @@ #endif #if !defined(BOOST_DLL_INTERFACE_UNIT) +#if !defined(BOOST_DLL_USE_STD_MODULE) #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace experimental { namespace detail { diff --git a/include/boost/dll/detail/macho_info.hpp b/include/boost/dll/detail/macho_info.hpp index bb9bd715..da6015cf 100644 --- a/include/boost/dll/detail/macho_info.hpp +++ b/include/boost/dll/detail/macho_info.hpp @@ -15,11 +15,13 @@ #endif #if !defined(BOOST_DLL_INTERFACE_UNIT) +#if !defined(BOOST_DLL_USE_STD_MODULE) #include #include #include #include // for std::getline #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { diff --git a/include/boost/dll/detail/pe_info.hpp b/include/boost/dll/detail/pe_info.hpp index acbb9c08..8bfcaec2 100644 --- a/include/boost/dll/detail/pe_info.hpp +++ b/include/boost/dll/detail/pe_info.hpp @@ -15,11 +15,13 @@ #endif #if !defined(BOOST_DLL_INTERFACE_UNIT) +#if !defined(BOOST_DLL_USE_STD_MODULE) #include #include #include #include // for std::getline #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { diff --git a/include/boost/dll/detail/posix/path_from_handle.hpp b/include/boost/dll/detail/posix/path_from_handle.hpp index cce67c69..372afce1 100644 --- a/include/boost/dll/detail/posix/path_from_handle.hpp +++ b/include/boost/dll/detail/posix/path_from_handle.hpp @@ -26,7 +26,9 @@ #if !defined(BOOST_DLL_INTERFACE_UNIT) # include # include +#if !defined(BOOST_DLL_USE_STD_MODULE) # include // for std::ptrdiff_t +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { diff --git a/include/boost/dll/detail/posix/program_location_impl.hpp b/include/boost/dll/detail/posix/program_location_impl.hpp index b0034524..0075632a 100644 --- a/include/boost/dll/detail/posix/program_location_impl.hpp +++ b/include/boost/dll/detail/posix/program_location_impl.hpp @@ -23,7 +23,9 @@ #if BOOST_OS_MACOS || BOOST_OS_IOS #if !defined(BOOST_DLL_INTERFACE_UNIT) +#if !defined(BOOST_DLL_USE_STD_MODULE) #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #include #endif // !defined(BOOST_DLL_INTERFACE_UNIT) @@ -51,7 +53,9 @@ namespace boost { namespace dll { namespace detail { #elif BOOST_OS_SOLARIS #if !defined(BOOST_DLL_INTERFACE_UNIT) +#if !defined(BOOST_DLL_USE_STD_MODULE) #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { @@ -65,10 +69,12 @@ namespace boost { namespace dll { namespace detail { #elif BOOST_OS_BSD_FREE #if !defined(BOOST_DLL_INTERFACE_UNIT) +#if !defined(BOOST_DLL_USE_STD_MODULE) #include +#include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #include #include -#include #endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { @@ -133,8 +139,10 @@ namespace boost { namespace dll { namespace detail { #elif BOOST_OS_QNX #if !defined(BOOST_DLL_INTERFACE_UNIT) +#if !defined(BOOST_DLL_USE_STD_MODULE) #include #include // for std::getline +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { diff --git a/include/boost/dll/detail/posix/shared_library_impl.hpp b/include/boost/dll/detail/posix/shared_library_impl.hpp index e7e5568e..07311396 100644 --- a/include/boost/dll/detail/posix/shared_library_impl.hpp +++ b/include/boost/dll/detail/posix/shared_library_impl.hpp @@ -18,10 +18,12 @@ #include #include +#if !defined(BOOST_DLL_USE_STD_MODULE) #include // std::move +#include // strncmp +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #include -#include // strncmp #if !BOOST_OS_MACOS && !BOOST_OS_IOS && !BOOST_OS_QNX && !BOOST_OS_CYGWIN # include #elif BOOST_OS_QNX diff --git a/include/boost/dll/detail/system_error.hpp b/include/boost/dll/detail/system_error.hpp index ba7418d5..db81d79d 100644 --- a/include/boost/dll/detail/system_error.hpp +++ b/include/boost/dll/detail/system_error.hpp @@ -26,7 +26,9 @@ # include #endif +#if !defined(BOOST_DLL_USE_STD_MODULE) #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) diff --git a/include/boost/dll/detail/type_info.hpp b/include/boost/dll/detail/type_info.hpp index 4754294e..c7d77764 100644 --- a/include/boost/dll/detail/type_info.hpp +++ b/include/boost/dll/detail/type_info.hpp @@ -16,8 +16,10 @@ # include # endif +#if !defined(BOOST_DLL_USE_STD_MODULE) #include #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { diff --git a/include/boost/dll/detail/windows/shared_library_impl.hpp b/include/boost/dll/detail/windows/shared_library_impl.hpp index a9ee2ab3..093dc08e 100644 --- a/include/boost/dll/detail/windows/shared_library_impl.hpp +++ b/include/boost/dll/detail/windows/shared_library_impl.hpp @@ -19,7 +19,9 @@ #include +#if !defined(BOOST_DLL_USE_STD_MODULE) #include // std::move +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) #include diff --git a/include/boost/dll/import.hpp b/include/boost/dll/import.hpp index b98dfcce..110e6b40 100644 --- a/include/boost/dll/import.hpp +++ b/include/boost/dll/import.hpp @@ -22,8 +22,10 @@ #endif #if !defined(BOOST_DLL_INTERFACE_UNIT) +#if !defined(BOOST_DLL_USE_STD_MODULE) #include // std::addressof #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) #include diff --git a/include/boost/dll/import_class.hpp b/include/boost/dll/import_class.hpp index 09fbf835..4aee7e0d 100644 --- a/include/boost/dll/import_class.hpp +++ b/include/boost/dll/import_class.hpp @@ -23,8 +23,10 @@ #endif #if !defined(BOOST_DLL_INTERFACE_UNIT) +#if !defined(BOOST_DLL_USE_STD_MODULE) #include #include // std::move +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) #include diff --git a/include/boost/dll/import_mangled.hpp b/include/boost/dll/import_mangled.hpp index 1607a99e..e9939ab6 100644 --- a/include/boost/dll/import_mangled.hpp +++ b/include/boost/dll/import_mangled.hpp @@ -28,11 +28,12 @@ #endif #if !defined(BOOST_DLL_INTERFACE_UNIT) +#if !defined(BOOST_DLL_USE_STD_MODULE) #include // std::addressof #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) -#include #include #include diff --git a/include/boost/dll/library_info.hpp b/include/boost/dll/library_info.hpp index 352fe8ed..423e0888 100644 --- a/include/boost/dll/library_info.hpp +++ b/include/boost/dll/library_info.hpp @@ -29,8 +29,10 @@ #include #include +#if !defined(BOOST_DLL_USE_STD_MODULE) #include #include +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) #include diff --git a/include/boost/dll/runtime_symbol_info.hpp b/include/boost/dll/runtime_symbol_info.hpp index 74e17947..c19db0f9 100644 --- a/include/boost/dll/runtime_symbol_info.hpp +++ b/include/boost/dll/runtime_symbol_info.hpp @@ -25,7 +25,9 @@ #include #include +#if !defined(BOOST_DLL_USE_STD_MODULE) #include // std::addressof +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) #if BOOST_OS_WINDOWS diff --git a/include/boost/dll/shared_library.hpp b/include/boost/dll/shared_library.hpp index 3e037f7a..7f78f4a8 100644 --- a/include/boost/dll/shared_library.hpp +++ b/include/boost/dll/shared_library.hpp @@ -27,8 +27,10 @@ #include #include +#if !defined(BOOST_DLL_USE_STD_MODULE) #include #include // std::move +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) #include diff --git a/include/boost/dll/smart_library.hpp b/include/boost/dll/smart_library.hpp index 0e047bee..2ad121f1 100644 --- a/include/boost/dll/smart_library.hpp +++ b/include/boost/dll/smart_library.hpp @@ -25,8 +25,10 @@ #include #if !defined(BOOST_DLL_INTERFACE_UNIT) +#if !defined(BOOST_DLL_USE_STD_MODULE) #include #include // std::move +#endif // !defined(BOOST_DLL_USE_STD_MODULE) #endif // !defined(BOOST_DLL_INTERFACE_UNIT) #if (__cplusplus < 201103L) && (!defined(_MSVC_LANG) || _MSVC_LANG < 201103L) diff --git a/modules/boost_dll.cppm b/modules/boost_dll.cppm index ebe7b5a7..bfd2cbec 100644 --- a/modules/boost_dll.cppm +++ b/modules/boost_dll.cppm @@ -16,8 +16,10 @@ module; #include #ifdef BOOST_DLL_USE_STD_FS +# ifndef BOOST_DLL_USE_STD_MODULE # include # include +# endif #else # include # include @@ -30,9 +32,12 @@ module; # include #endif +#ifndef BOOST_DLL_USE_STD_MODULE +#include #include #include #include +#endif #ifndef _MSC_VER #include @@ -42,6 +47,10 @@ module; export module boost.dll; +#ifdef BOOST_DLL_USE_STD_MODULE +import std; +#endif + #ifdef __clang__ # pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" #endif diff --git a/modules/sample_plugin.cppm b/modules/sample_plugin.cppm index 78073a33..95507bf6 100644 --- a/modules/sample_plugin.cppm +++ b/modules/sample_plugin.cppm @@ -7,6 +7,8 @@ module; +#include + #include export module sample_plugin; From 6efabaf5c643bcf301426aa9eb6705200392e9af Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 19 Apr 2026 11:37:34 +0000 Subject: [PATCH 31/35] add modules import std tests to CI --- .github/workflows/ci.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e512106..c3159610 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,6 +105,25 @@ jobs: ./b2 -d0 headers ./b2 -j4 variant=debug tools/inspect + - name: Run modules tests + if: ${{matrix.toolset == 'clang-19'}} + run: | + cd ../boost-root/libs/$LIBRARY + cmake -S test/cmake_subdir_test -B __build \ + -GNinja \ + -DBUILD_TESTING=1 \ + -DBOOST_DLL_USE_STD_FS=1 \ + -DBOOST_USE_MODULES=1 \ + -DCMAKE_CXX_COMPILER=${{matrix.compiler}} \ + -DCMAKE_CXX_FLAGS="-stdlib=libc++" \ + -DCMAKE_CXX_STANDARD=23 \ + -DCMAKE_CXX_MODULE_STD=ON \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 + + cmake --build __build + ctest --test-dir __build --output-on-failure --no-tests=error -VV + rm -rf __build + - name: Run modules tests without 'import std;' if: ${{matrix.toolset == 'clang-19'}} run: | From fac318029652b0934cc25ffe4278274787c19893 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 16 May 2026 07:31:54 +0000 Subject: [PATCH 32/35] fix build --- modules/boost_dll.cppm | 3 +++ modules/sample_plugin.cpp | 1 + test/cmake_subdir_test/CMakeLists.txt | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/boost_dll.cppm b/modules/boost_dll.cppm index ebe7b5a7..d77d022b 100644 --- a/modules/boost_dll.cppm +++ b/modules/boost_dll.cppm @@ -30,9 +30,12 @@ module; # include #endif +#include +#include #include #include #include +#include #ifndef _MSC_VER #include diff --git a/modules/sample_plugin.cpp b/modules/sample_plugin.cpp index 14e17857..4829ee13 100644 --- a/modules/sample_plugin.cpp +++ b/modules/sample_plugin.cpp @@ -9,6 +9,7 @@ module; #include #include +#include #include diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt index 7fc41094..b57b3488 100644 --- a/test/cmake_subdir_test/CMakeLists.txt +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -35,7 +35,6 @@ preprocessor mpl tuple type_traits -static_assert utility io typeof @@ -48,6 +47,7 @@ concept_check optional smart_ptr scope +unordered ) From 486c803930ef8c5e92097ea8a2625e87719452d5 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 16 May 2026 07:41:06 +0000 Subject: [PATCH 33/35] try fix cmake build --- test/cmake_subdir_test/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt index b57b3488..086a4f80 100644 --- a/test/cmake_subdir_test/CMakeLists.txt +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -38,7 +38,6 @@ type_traits utility io typeof -functional function bind filesystem From c7743a0f99fa744d25cddbbfd20537b72d4c18e9 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sat, 16 May 2026 07:43:00 +0000 Subject: [PATCH 34/35] try fix cmake build --- test/cmake_subdir_test/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt index b57b3488..086a4f80 100644 --- a/test/cmake_subdir_test/CMakeLists.txt +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -38,7 +38,6 @@ type_traits utility io typeof -functional function bind filesystem From b41a5f046b0d7a0266d36876f890233d054a5f35 Mon Sep 17 00:00:00 2001 From: Fedor Osetrov Date: Sun, 24 May 2026 09:23:59 +0000 Subject: [PATCH 35/35] fix conflicts --- .../detail/posix/program_location_impl.hpp | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/include/boost/dll/detail/posix/program_location_impl.hpp b/include/boost/dll/detail/posix/program_location_impl.hpp index ecda57b3..0075632a 100644 --- a/include/boost/dll/detail/posix/program_location_impl.hpp +++ b/include/boost/dll/detail/posix/program_location_impl.hpp @@ -53,17 +53,9 @@ namespace boost { namespace dll { namespace detail { #elif BOOST_OS_SOLARIS #if !defined(BOOST_DLL_INTERFACE_UNIT) -<<<<<<< HEAD #if !defined(BOOST_DLL_USE_STD_MODULE) -||||||| 079d73e -======= ->>>>>>> 62f854993375e5f39f32851c5f8ad307b96a3733 #include -<<<<<<< HEAD #endif // !defined(BOOST_DLL_USE_STD_MODULE) -||||||| 079d73e -======= ->>>>>>> 62f854993375e5f39f32851c5f8ad307b96a3733 #endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { @@ -77,22 +69,12 @@ namespace boost { namespace dll { namespace detail { #elif BOOST_OS_BSD_FREE #if !defined(BOOST_DLL_INTERFACE_UNIT) -<<<<<<< HEAD #if !defined(BOOST_DLL_USE_STD_MODULE) -||||||| 079d73e -======= ->>>>>>> 62f854993375e5f39f32851c5f8ad307b96a3733 #include #include #endif // !defined(BOOST_DLL_USE_STD_MODULE) #include #include -<<<<<<< HEAD -||||||| 079d73e -#include -======= -#include ->>>>>>> 62f854993375e5f39f32851c5f8ad307b96a3733 #endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail { @@ -157,18 +139,10 @@ namespace boost { namespace dll { namespace detail { #elif BOOST_OS_QNX #if !defined(BOOST_DLL_INTERFACE_UNIT) -<<<<<<< HEAD #if !defined(BOOST_DLL_USE_STD_MODULE) -||||||| 079d73e -======= ->>>>>>> 62f854993375e5f39f32851c5f8ad307b96a3733 #include #include // for std::getline -<<<<<<< HEAD #endif // !defined(BOOST_DLL_USE_STD_MODULE) -||||||| 079d73e -======= ->>>>>>> 62f854993375e5f39f32851c5f8ad307b96a3733 #endif // !defined(BOOST_DLL_INTERFACE_UNIT) namespace boost { namespace dll { namespace detail {