2
0
mirror of https://github.com/boostorg/dll.git synced 2026-02-18 14:02:16 +00:00
Files
dll/test/shared_library_search_symbol_test.cpp
2014-09-26 15:18:41 +04:00

46 lines
1.2 KiB
C++

// Copyright 2011-2012 Renato Tegon Forti
// Copyright 2014 Renato Tegon Forti, 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.search_symbol("say_hello"));
BOOST_CHECK(sl.search_symbol("lib_version"));
BOOST_CHECK(sl.search_symbol("integer_g"));
BOOST_CHECK(!sl.search_symbol("i_do_not_exist"));
}
{
shared_library sl(program_location());
BOOST_CHECK(sl.search_symbol("exef"));
BOOST_CHECK(!sl.search_symbol("i_do_not_exist"));
}
exef(); // Make sure that this function still callable in traditional way
return 0;
}