]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/dll/test/shared_library_search_symbol_test.cpp
d621c8250ec526b045479700d825637ed0c55064
1 // Copyright 2011-2012 Renato Tegon Forti
2 // Copyright 2014 Renato Tegon Forti, Antony Polukhin.
3 // Copyright 2015 Antony Polukhin.
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt
7 // or copy at http://www.boost.org/LICENSE_1_0.txt)
9 // For more information, see http://www.boost.org
11 #include "../example/b2_workarounds.hpp"
12 #include <boost/dll.hpp>
13 #include <boost/core/lightweight_test.hpp>
17 extern "C" void BOOST_SYMBOL_EXPORT
exef() {
20 int main(int argc
, char* argv
[])
22 using namespace boost::dll
;
24 boost::filesystem::path shared_library_path
= b2_workarounds::first_lib_from_argv(argc
, argv
);
25 BOOST_TEST(shared_library_path
.string().find("test_library") != std::string::npos
);
26 BOOST_TEST(b2_workarounds::is_shared_library(shared_library_path
));
27 std::cout
<< "Library: " << shared_library_path
;
30 shared_library
sl(shared_library_path
);
31 BOOST_TEST(sl
.has("say_hello"));
32 BOOST_TEST(sl
.has("lib_version"));
33 BOOST_TEST(sl
.has("integer_g"));
34 BOOST_TEST(sl
.has(std::string("integer_g")));
35 BOOST_TEST(!sl
.has("i_do_not_exist"));
36 BOOST_TEST(!sl
.has(std::string("i_do_not_exist")));
40 shared_library
sl(program_location());
41 BOOST_TEST(sl
.has("exef"));
42 BOOST_TEST(!sl
.has("i_do_not_exist"));
46 exef(); // Make sure that this function still callable in traditional way
47 return boost::report_errors();