2
0
mirror of https://github.com/boostorg/dll.git synced 2026-02-22 03:12:25 +00:00
Files
dll/test/shared_library_search_symbol_test.cpp
2015-08-21 23:26:25 +03:00

49 lines
1.3 KiB
C++

// Copyright 2011-2012 Renato Tegon Forti
// Copyright 2014 Renato Tegon Forti, Antony Polukhin.
// 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 <boost/dll.hpp>
#include <boost/test/minimal.hpp>
#include "../example/shared_lib_path.hpp"
// Unit Tests
extern "C" void BOOST_SYMBOL_EXPORT exef() {
}
int test_main(int argc, char* argv[])
{
using namespace boost::dll;
BOOST_CHECK(argc >= 2);
boost::filesystem::path shared_library_path = shared_lib_path(argv[1], L"test_library");
std::cout << "Library: " << shared_library_path;
{
shared_library sl(shared_library_path);
BOOST_CHECK(sl.has("say_hello"));
BOOST_CHECK(sl.has("lib_version"));
BOOST_CHECK(sl.has("integer_g"));
BOOST_CHECK(sl.has(std::string("integer_g")));
BOOST_CHECK(!sl.has("i_do_not_exist"));
BOOST_CHECK(!sl.has(std::string("i_do_not_exist")));
}
{
shared_library sl(program_location());
BOOST_CHECK(sl.has("exef"));
BOOST_CHECK(!sl.has("i_do_not_exist"));
}
exef(); // Make sure that this function still callable in traditional way
return 0;
}