Add dll_test (to check for visibility issues)

This commit is contained in:
Peter Dimov
2018-09-17 21:50:47 +03:00
parent 4eb53db537
commit 4e2f236116
3 changed files with 45 additions and 0 deletions

View File

@ -276,3 +276,8 @@ run lw_thread_test.cpp : : : <threading>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 : <link>shared:<define>DLL_TEST_DYN_LINK=1 ;
run dll_test_main.cpp dll_test : : : <link>static : dll_test_static ;
run dll_test_main.cpp dll_test : : : <link>shared : dll_test_shared ;

20
test/dll_test_lib.cpp Normal file
View File

@ -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 <boost/shared_ptr.hpp>
#include <boost/config.hpp>
#if defined(DLL_TEST_DYN_LINK)
# define EXPORT BOOST_SYMBOL_EXPORT
#else
# define EXPORT
#endif
EXPORT boost::shared_ptr<int> dll_test()
{
return boost::shared_ptr<int>( new int( 42 ) );
}

20
test/dll_test_main.cpp Normal file
View File

@ -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 <boost/shared_ptr.hpp>
#include <boost/core/lightweight_test.hpp>
boost::shared_ptr<int> dll_test();
int main()
{
boost::shared_ptr<int> p1 = dll_test();
BOOST_TEST_EQ( *p1, 42 );
return boost::report_errors();
}