diff --git a/test/Jamfile b/test/Jamfile index 6cff91a..1df858f 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -276,3 +276,8 @@ run lw_thread_test.cpp : : : multi ; compile sp_windows_h_test.cpp ; compile spinlock_windows_h_test.cpp ; compile yield_k_windows_h_test.cpp ; + +lib dll_test : dll_test_lib.cpp : shared:DLL_TEST_DYN_LINK=1 ; + +run dll_test_main.cpp dll_test : : : static : dll_test_static ; +run dll_test_main.cpp dll_test : : : shared : dll_test_shared ; diff --git a/test/dll_test_lib.cpp b/test/dll_test_lib.cpp new file mode 100644 index 0000000..0098490 --- /dev/null +++ b/test/dll_test_lib.cpp @@ -0,0 +1,20 @@ +// Copyright 2018 Peter Dimov +// +// 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 + +#if defined(DLL_TEST_DYN_LINK) +# define EXPORT BOOST_SYMBOL_EXPORT +#else +# define EXPORT +#endif + +EXPORT boost::shared_ptr dll_test() +{ + return boost::shared_ptr( new int( 42 ) ); +} diff --git a/test/dll_test_main.cpp b/test/dll_test_main.cpp new file mode 100644 index 0000000..c37bd25 --- /dev/null +++ b/test/dll_test_main.cpp @@ -0,0 +1,20 @@ +// Copyright 2018 Peter Dimov +// +// 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 + +boost::shared_ptr dll_test(); + +int main() +{ + boost::shared_ptr p1 = dll_test(); + + BOOST_TEST_EQ( *p1, 42 ); + + return boost::report_errors(); +}