From 0187188b77358f8c444b1ab516c8e35e7de18859 Mon Sep 17 00:00:00 2001 From: Hartmut Kaiser Date: Fri, 28 Jun 2019 10:51:13 -0500 Subject: [PATCH] Explicitly reference symbols to re-export --- libs/config/CMakeLists.txt | 1 + .../include/hpx/config/force_linking.hpp | 8 +++++++- libs/config/src/force_linking.cpp | 20 +++++++++++++++++++ libs/config/src/version.cpp | 6 ------ 4 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 libs/config/src/force_linking.cpp diff --git a/libs/config/CMakeLists.txt b/libs/config/CMakeLists.txt index 70ad7a369a2e..93926595f9f5 100644 --- a/libs/config/CMakeLists.txt +++ b/libs/config/CMakeLists.txt @@ -33,6 +33,7 @@ set(config_headers # Default location is $HPX_ROOT/libs/config/src set(config_sources + force_linking.cpp version.cpp ) diff --git a/libs/config/include/hpx/config/force_linking.hpp b/libs/config/include/hpx/config/force_linking.hpp index 21125c1072f2..3580fb02c895 100644 --- a/libs/config/include/hpx/config/force_linking.hpp +++ b/libs/config/include/hpx/config/force_linking.hpp @@ -8,7 +8,13 @@ namespace hpx { namespace config { - void force_linking(); + struct force_linking_helper + { + const char* const hpx_version; + const char* const boost_version; + }; + + force_linking_helper& force_linking(); }} #endif diff --git a/libs/config/src/force_linking.cpp b/libs/config/src/force_linking.cpp new file mode 100644 index 000000000000..86ef2c2dc7ac --- /dev/null +++ b/libs/config/src/force_linking.cpp @@ -0,0 +1,20 @@ +// Copyright (c) 2019 The STE||AR GROUP +// +// 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 + +namespace hpx { namespace config +{ + // reference all symbols that have to be explicitly linked with the core + // library + force_linking_helper& force_linking() + { + static force_linking_helper helper{ + hpx::HPX_CHECK_VERSION, hpx::HPX_CHECK_BOOST_VERSION}; + return helper; + } +}} + diff --git a/libs/config/src/version.cpp b/libs/config/src/version.cpp index e0f8fba3981d..54a0ab2d62c6 100644 --- a/libs/config/src/version.cpp +++ b/libs/config/src/version.cpp @@ -7,7 +7,6 @@ //////////////////////////////////////////////////////////////////////////////// #include -#include #include #include @@ -18,9 +17,4 @@ namespace hpx HPX_PP_STRINGIZE(HPX_CHECK_VERSION); HPX_EXPORT char const HPX_CHECK_BOOST_VERSION[] = HPX_PP_STRINGIZE(HPX_CHECK_BOOST_VERSION); - - namespace config - { - void force_linking() {} - } }