// Copyright 2011-2012 Renato Tegon Forti // Copyright 2015 Antony Polukhin // // 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) // For more information, see http://www.boost.org #include "../example/b2_workarounds.hpp" #include #include #include #include #include struct override_class {}; int test_main(int argc, char* argv[]) { using namespace boost::dll; using mangled_storage = detail::mangled_storage_impl; boost::filesystem::path pt; for (int i = 1; i < argc; ++i) { boost::filesystem::path p(argv[i]); if ((p.extension() == ".dll") || (p.extension() == ".so")) { pt = p; break; } } BOOST_REQUIRE(!pt.empty()); std::cout << "Library: " << pt; library_info lib{pt}; mangled_storage ms(lib); std::string v; v = ms.get_variable("some_space::variable"); BOOST_CHECK(!v.empty()); //check if a symbols was found. BOOST_CHECK(v != "some_space::variable"); //demangle is different v = ms.get_variable("some_space::variable_typo"); BOOST_CHECK(v.empty()); v = ms.get_variable("unscoped_c_var"); BOOST_CHECK(!v.empty()); //check if a symbols was found. v = ms.get_variable("unscoped_var"); BOOST_CHECK(!v.empty()); //check if a symbols was found. v = ms.get_function("some_space::scoped_fun"); BOOST_CHECK(!v.empty()); BOOST_CHECK(v != "some_space::scoped_fun"); auto v1 = ms.get_function("overloaded"); auto v2 = ms.get_function("overloaded"); BOOST_CHECK(!v1.empty()); BOOST_CHECK(!v2.empty()); BOOST_CHECK(v1 != v2); v = ms.get_variable("some_space::some_class::value"); BOOST_CHECK(!v.empty()); BOOST_CHECK(v != "some_space::some_class::value"); v = ms.get_function("some_space::some_class::set_value"); BOOST_CHECK(!v.empty()); BOOST_CHECK(v != "some_space::some_class::set_value"); ms.add_alias("some_space::some_class"); auto ctor1 = ms.get_constructor(); BOOST_CHECK(!ctor1.empty()); auto ctor2 = ms.get_constructor(); BOOST_CHECK(!ctor2.empty()); v = ms.get_mem_fn("func"); BOOST_CHECK(!v.empty()); v = ms.get_mem_fn("func"); BOOST_CHECK(!v.empty()); auto dtor = ms.get_destructor(); BOOST_CHECK(!dtor.empty()); auto var1 = ms.get_function &)>("use_variant"); auto var2 = ms.get_function &)>("use_variant"); BOOST_CHECK(!var1.empty()); BOOST_CHECK(!var2.empty()); return 0; }