• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 Antony Polukhin
2 //
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt
5 // or copy at http://www.boost.org/LICENSE_1_0.txt)
6 
7 // For more information, see http://www.boost.org
8 
9 #include "../example/b2_workarounds.hpp"
10 
11 #include <boost/dll/library_info.hpp>
12 #include <boost/core/lightweight_test.hpp>
13 
14 // Unit Tests
15 
16 #include <iterator>
17 
main(int argc,char * argv[])18 int main(int argc, char* argv[])
19 {
20     boost::dll::fs::path shared_library_path = b2_workarounds::first_lib_from_argv(argc, argv);
21     BOOST_TEST(shared_library_path.string().find("empty_library") != std::string::npos);
22 
23     boost::dll::library_info lib_info(shared_library_path);
24     std::vector<std::string> sec = lib_info.sections();
25     std::copy(sec.begin(), sec.end(), std::ostream_iterator<std::string>(std::cout, ",  "));
26 
27     std::cout << "\n\n\n";
28     std::vector<std::string> symb = lib_info.symbols();
29     std::copy(symb.begin(), symb.end(), std::ostream_iterator<std::string>(std::cout, "\n"));
30 
31     symb = lib_info.symbols("boostdll");
32     BOOST_TEST(symb.empty());
33 
34     std::vector<std::string> empty = lib_info.symbols("empty");
35     BOOST_TEST(empty.empty());
36 
37     BOOST_TEST(lib_info.symbols("section_that_does_not_exist").empty());
38 
39     return boost::report_errors();
40 }
41