Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d66d431
support cmake tests
fdr400 Apr 13, 2026
30d2374
add .gitignore
fdr400 Apr 13, 2026
a8cce34
add cmake tests in CI
fdr400 Apr 18, 2026
8432de0
up
fdr400 Apr 18, 2026
97c6ba1
fix cwd
fdr400 Apr 18, 2026
57ea85f
use std::filesystem in cmake subdir tests
fdr400 Apr 18, 2026
9f20d70
try fix build
fdr400 Apr 18, 2026
8de9466
try fix build
fdr400 Apr 18, 2026
8b5b852
work
fdr400 Apr 18, 2026
3d97b8b
fix debug tests
fdr400 Apr 18, 2026
2eeb284
Merge branch 'feature/cmake-tests' into feature/cxx20-modules
fdr400 Apr 18, 2026
3bb9029
add shared libraries to dependencies
fdr400 Apr 18, 2026
a84360c
Merge branch 'feature/cmake-tests' into feature/cxx20-modules
fdr400 Apr 18, 2026
1c69709
add boost.dll module support
fdr400 Apr 19, 2026
af1c6ac
depend each test from its args
fdr400 Apr 19, 2026
a0a9287
Merge branch 'feature/cmake-tests' into feature/cxx20-modules
fdr400 Apr 19, 2026
dfc4653
fix build with std::filesystem
fdr400 Apr 19, 2026
aa2e196
remove redundant add_dependencies, fix no args add_dependencies
fdr400 Apr 19, 2026
c12ed5d
Merge branch 'feature/cmake-tests' into feature/cxx20-modules
fdr400 Apr 19, 2026
c74cb78
add modules tests to CI
fdr400 Apr 19, 2026
eff8c4b
fix boost_shared_ptr test
fdr400 Apr 19, 2026
9ea777f
Merge branch 'feature/cmake-tests' into feature/cxx20-modules
fdr400 Apr 19, 2026
a6329e2
add copyright
fdr400 Apr 19, 2026
e99a587
add module usage sample
fdr400 Apr 19, 2026
9c4c525
fix typos
fdr400 Apr 19, 2026
80c4521
rollback strange rename
fdr400 Apr 19, 2026
cda1667
better
fdr400 Apr 19, 2026
1d91f31
better
fdr400 Apr 19, 2026
c33e508
better
fdr400 Apr 19, 2026
19b49e9
fix modules CI
fdr400 Apr 19, 2026
c004678
use headers file set
fdr400 Apr 19, 2026
320b3e6
add missing include
fdr400 Apr 19, 2026
f14cee4
remove strange includes
fdr400 Apr 19, 2026
943a95a
use report error from module in this_line_location
fdr400 Apr 19, 2026
2fd3261
Merge branch 'develop' of github.com:fdr400/dll into feature/cmake-tests
fdr400 May 16, 2026
b1082eb
Merge branch 'feature/cmake-tests' into feature/cxx20-modules
fdr400 May 16, 2026
fac3180
fix build
fdr400 May 16, 2026
c7743a0
try fix cmake build
fdr400 May 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,23 @@ 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++" \
-DCMAKE_CXX_STANDARD=20

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: |
Expand Down
29 changes: 23 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# 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

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)

Expand Down Expand Up @@ -48,16 +49,32 @@ target_link_libraries(boost_dll_boost_fs
Boost::filesystem
)

# Detault library
# Default library

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 INTERFACE)
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(
Expand Down
3 changes: 2 additions & 1 deletion example/b2_workarounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
#ifndef BOOST_DLL_EXAMPLE_COMMON_B2_WORKAROUNDS_HPP
#define BOOST_DLL_EXAMPLE_COMMON_B2_WORKAROUNDS_HPP

#include <boost/dll/config.hpp>
#include <boost/filesystem.hpp>
#include <boost/system/error_code.hpp>
#include <iostream>
#include <cctype>

#include <boost/dll/config.hpp>

namespace b2_workarounds {


Expand Down
2 changes: 1 addition & 1 deletion example/getting_started_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// MinGW related workaround
#define BOOST_DLL_FORCE_ALIAS_INSTANTIATION

#include <boost/dll.hpp>
#include <string>
#include <boost/dll.hpp>

#define API extern "C" BOOST_SYMBOL_EXPORT

Expand Down
4 changes: 2 additions & 2 deletions example/tutorial4/load_self.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#define BOOST_DLL_FORCE_ALIAS_INSTANTIATION

//[plugcpp_my_plugin_load_self
#include <boost/dll/shared_library.hpp> // for shared_library
#include <boost/dll/runtime_symbol_info.hpp> // for program_location()
#include "static_plugin.hpp" // without this headers some compilers may optimize out the `create_plugin` symbol
#include <iostream>
#include <memory>
#include <boost/dll/shared_library.hpp> // for shared_library
#include <boost/dll/runtime_symbol_info.hpp> // for program_location()

namespace dll = boost::dll;

Expand Down
2 changes: 1 addition & 1 deletion example/tutorial4/static_plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
// or copy at http://www.boost.org/LICENSE_1_0.txt)

//[plugcpp_my_plugin_static
#include <boost/dll/alias.hpp> // for BOOST_DLL_ALIAS
#include <memory>
#include "../tutorial_common/my_plugin_api.hpp"
#include <boost/dll/alias.hpp> // for BOOST_DLL_ALIAS

namespace my_namespace {
std::shared_ptr<my_plugin_api> create_plugin(); // Forward declaration
Expand Down
2 changes: 1 addition & 1 deletion example/tutorial6/on_unload_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#define BOOST_DLL_FORCE_ALIAS_INSTANTIATION

//[plugcpp_on_unload
#include <boost/dll/alias.hpp> // for BOOST_DLL_ALIAS
#include <functional>
#include <vector>
#include <boost/dll/alias.hpp> // for BOOST_DLL_ALIAS

namespace my_namespace {

Expand Down
2 changes: 1 addition & 1 deletion example/tutorial7/library1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#define BOOST_DLL_FORCE_ALIAS_INSTANTIATION

//[plugcpp_tutorial7_library1
#include <boost/dll/alias.hpp> // for BOOST_DLL_ALIAS_SECTIONED
#include <iostream>
#include <string>
#include <boost/dll/alias.hpp> // for BOOST_DLL_ALIAS_SECTIONED

void print(const std::string& s) {
std::cout << "Hello, " << s << '!' << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion example/tutorial7/library2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#define BOOST_DLL_FORCE_ALIAS_INSTANTIATION

//[plugcpp_tutorial7_library2
#include <boost/dll/alias.hpp> // for BOOST_DLL_ALIAS_SECTIONED
#include <string>
#include <iostream>
#include <boost/dll/alias.hpp> // for BOOST_DLL_ALIAS_SECTIONED

void print_howdy(const std::string& s) {
std::cout << "How're you doing, " << s << '?' << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion example/tutorial8/refcounting_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

//[plugcpp_my_plugin_refcounting_api
#include "../tutorial_common/my_plugin_api.hpp"
#include <memory>
#include <boost/dll/config.hpp>

class my_refcounting_api: public my_plugin_api {
Expand All @@ -19,7 +20,6 @@ class my_refcounting_api: public my_plugin_api {


//[plugcpp_library_holding_deleter_api_bind
#include <memory>
#include <boost/dll/shared_library.hpp>

struct library_holding_deleter {
Expand Down
2 changes: 1 addition & 1 deletion example/tutorial8/tutorial8_static.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
// or copy at http://www.boost.org/LICENSE_1_0.txt)

//[callplugcpp_tutorial8_static
#include <boost/dll/runtime_symbol_info.hpp> // program_location()
#include <iostream>
#include "refcounting_plugin.hpp"
#include <boost/dll/runtime_symbol_info.hpp> // program_location()

int main() {
std::shared_ptr<my_refcounting_api> plugin = get_plugin(
Expand Down
15 changes: 11 additions & 4 deletions include/boost/dll.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,23 @@
/// \file boost/dll.hpp
/// \brief Includes all the non-experimental headers of the Boost.DLL library.

#include <boost/dll/detail/config.hpp>

#if !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT)

#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif

#include <boost/dll/config.hpp>
#include <boost/dll/shared_library.hpp>
#include <boost/dll/alias.hpp>
#include <boost/dll/import.hpp>
#include <boost/dll/library_info.hpp>
#include <boost/dll/runtime_symbol_info.hpp>

#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT)

#include <boost/dll/alias.hpp>

#endif // BOOST_DLL_DLL_HPP

27 changes: 18 additions & 9 deletions include/boost/dll/alias.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <boost/dll/detail/config.hpp>

#if !defined(BOOST_USE_MODULES) || defined(BOOST_DLL_INTERFACE_UNIT)

#include <boost/dll/config.hpp>

#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif

#if !defined(BOOST_DLL_INTERFACE_UNIT)
#include <boost/predef/compiler.h>
#include <boost/predef/os.h>
#include <boost/dll/detail/aggressive_ptr_cast.hpp>

#if BOOST_COMP_GNUC // MSVC does not have <stdint.h> and defines it in some other header, MinGW requires that header.
#include <stdint.h> // intptr_t
#endif
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)

#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#include <boost/dll/detail/aggressive_ptr_cast.hpp>

/// \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 {

Expand Down Expand Up @@ -284,6 +294,5 @@ namespace boost { namespace dll {

}} // namespace boost::dll


#endif // BOOST_DLL_ALIAS_HPP

19 changes: 14 additions & 5 deletions include/boost/dll/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <boost/dll/detail/config.hpp>

#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
Expand Down Expand Up @@ -44,9 +45,11 @@ using system_error = std::conditional_t<BOOST_DLL_USE_STD_FS, std::system_error,


#ifdef BOOST_DLL_USE_STD_FS
#include <filesystem>

#if !defined(BOOST_DLL_INTERFACE_UNIT)
#include <filesystem>
#include <system_error>
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)

namespace boost { namespace dll { namespace fs {

Expand All @@ -58,10 +61,12 @@ using std::system_error;

#else // BOOST_DLL_USE_STD_FS

#if !defined(BOOST_DLL_INTERFACE_UNIT)
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/system/system_error.hpp>
#include <boost/system/error_code.hpp>
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)

namespace boost { namespace dll { namespace fs {

Expand All @@ -76,7 +81,9 @@ using boost::system::system_error;

#ifdef BOOST_DLL_USE_BOOST_SHARED_PTR

#if !defined(BOOST_DLL_INTERFACE_UNIT)
#include <boost/make_shared.hpp>
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)

namespace boost { namespace dll { namespace detail {
template <class T>
Expand All @@ -86,7 +93,9 @@ namespace boost { namespace dll { namespace detail {

#else // BOOST_DLL_USE_STD_FS

#if !defined(BOOST_DLL_INTERFACE_UNIT)
#include <memory>
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)

namespace boost { namespace dll { namespace detail {
template <class T>
Expand All @@ -96,5 +105,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

2 changes: 2 additions & 0 deletions include/boost/dll/detail/aggressive_ptr_cast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
# pragma once
#endif

#if !defined(BOOST_DLL_INTERFACE_UNIT)
#include <cstring> // std::memcpy
#include <memory>
#include <type_traits>
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)

#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 301)
# pragma GCC system_header
Expand Down
29 changes: 29 additions & 0 deletions include/boost/dll/detail/config.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// 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

#if !defined(BOOST_DLL_INTERFACE_UNIT)
# include <boost/config.hpp>
# 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
5 changes: 5 additions & 0 deletions include/boost/dll/detail/demangling/demangle_symbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
#define BOOST_DLL_DEMANGLE_SYMBOL_HPP_

#include <boost/dll/config.hpp>

#if !defined(BOOST_DLL_INTERFACE_UNIT)
#include <string>
#include <algorithm>
#include <memory>
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)

#if defined(_MSC_VER) // MSVC, Clang-cl, and ICC on Windows

Expand Down Expand Up @@ -61,7 +64,9 @@ inline std::string demangle_symbol(const std::string& mangled_name)
}}}
#else

#if !defined(BOOST_DLL_INTERFACE_UNIT)
#include <boost/core/demangle.hpp>
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)

namespace boost
{
Expand Down
Loading
Loading