diff --git a/example/Jamfile.v2 b/example/Jamfile.v2 index bacf2b7..db5168d 100644 --- a/example/Jamfile.v2 +++ b/example/Jamfile.v2 @@ -39,5 +39,5 @@ exe getting_started ; exe load_self - : load_self.cpp + : tutorail3/load_self.cpp ; diff --git a/example/Jamfile.v2.orig b/example/Jamfile.v2.orig deleted file mode 100644 index 4166842..0000000 --- a/example/Jamfile.v2.orig +++ /dev/null @@ -1,38 +0,0 @@ -# -# Copyright Renato Tegon Forti 2011 - 2013. -# 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) -# - -project - : source-location . - : requirements - - # linux - linux:"-ldl" - - # others - shared:BOOST_ALL_DLL - /boost/system//boost_system - /boost/filesystem//boost_filesystem - multi - ; - - # our example plugin lib - lib plugin_library : plugin_library.cpp ; - lib getting_started_library : getting_started_library.cpp ; - install install-bin - : plugin_library getting_started_library : - windows:"C:/test/boost/application" - linux:/test/boost/application ; - - -# shared library sub-system -exe shared_library_load_plugin - : shared_library_load_plugin.cpp - ; - -exe getting_started - : getting_started.cpp - ; diff --git a/example/load_self.cpp b/example/tutorial3/load_self.cpp similarity index 93% rename from example/load_self.cpp rename to example/tutorial3/load_self.cpp index b02f493..acd84fb 100644 --- a/example/load_self.cpp +++ b/example/tutorial3/load_self.cpp @@ -13,11 +13,6 @@ #include #include -extern "C" BOOST_SYMBOL_EXPORT int sumexe(int x, int y) -{ - return x+y; -} - int main(int argc, char* argv[]) { std::cout << "Application started" << std::endl; diff --git a/example/tutorial3/static_plugin.cpp b/example/tutorial3/static_plugin.cpp new file mode 100644 index 0000000..9977b36 --- /dev/null +++ b/example/tutorial3/static_plugin.cpp @@ -0,0 +1,17 @@ +// 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 +#include + +extern "C" BOOST_SYMBOL_EXPORT int sumexe(int x, int y) +{ + return x+y; +} + diff --git a/include/boost/plugin/detail/posix/shared_library_impl.hpp b/include/boost/plugin/detail/posix/shared_library_impl.hpp index 246ac5c..1ca137b 100644 --- a/include/boost/plugin/detail/posix/shared_library_impl.hpp +++ b/include/boost/plugin/detail/posix/shared_library_impl.hpp @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -40,7 +39,7 @@ namespace boost { namespace plugin { -class shared_library_impl : noncopyable { +class shared_library_impl { BOOST_MOVABLE_BUT_NOT_COPYABLE(shared_library_impl) @@ -94,7 +93,7 @@ public: // "handle" for the dynamic library. If filename is NULL, then the // returned handle is for the main program. - handle_ = dlopen(NULL, DLOPEN_LAZY | DLOPEN_GLOBAL | RTLD_DEEPBIND); + handle_ = dlopen(NULL, RTLD_LAZY); if (!handle_) { ec = boost::system::error_code( diff --git a/include/boost/plugin/detail/windows/shared_library_impl.hpp b/include/boost/plugin/detail/windows/shared_library_impl.hpp index 0061e44..17b654f 100644 --- a/include/boost/plugin/detail/windows/shared_library_impl.hpp +++ b/include/boost/plugin/detail/windows/shared_library_impl.hpp @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -29,7 +28,7 @@ namespace boost { namespace plugin { -class shared_library_impl : noncopyable { +class shared_library_impl { BOOST_MOVABLE_BUT_NOT_COPYABLE(shared_library_impl) diff --git a/include/boost/plugin/shared_library.hpp b/include/boost/plugin/shared_library.hpp index 8d385f6..e50f3d9 100644 --- a/include/boost/plugin/shared_library.hpp +++ b/include/boost/plugin/shared_library.hpp @@ -201,7 +201,7 @@ public: base_t::load_self(ec); if (ec) { - boost::plugin::detail::report_error(ec, "load() failed"); + boost::plugin::detail::report_error(ec, "load_self() failed"); } } diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 1d76863..f53e74e 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -11,7 +11,10 @@ import testing ; import path ; -path-constant TEST_DIR : $(BOOST_ROOT)/bin.v2/libs/application/test ; +path-constant TEST_DIR : $(BOOST_ROOT)/bin.v2/libs/plugin/test ; + +# Static library that is not linked with any of the boost libs +lib static_plugin : ../example/tutorial3/static_plugin.cpp : static : : linux:"-rdynamic" ; project : source-location . @@ -21,11 +24,10 @@ project linux:"-ldl" # others - shared:BOOST_ALL_DLL + shared:BOOST_ALL_DLL /boost/system//boost_system /boost/filesystem//boost_filesystem multi - ; { @@ -39,11 +41,12 @@ project test-suite application : [ run shared_library_load_test.cpp : $(TEST_DIR) ] - [ run shared_library_search_symbol_test.cpp : $(TEST_DIR) ] - [ run shared_library_get_symbol_test.cpp : $(TEST_DIR) ] + [ run shared_library_search_symbol_test.cpp : $(TEST_DIR) : : linux:"-rdynamic" ] + [ run shared_library_get_symbol_test.cpp : $(TEST_DIR) : : linux:"-rdynamic" ] [ run shared_library_errors.cpp : $(TEST_DIR) : : always_show_run_output ] [ run ../example/getting_started.cpp : $(TEST_DIR) ] [ run ../example/tutorial1/tutorial1.cpp : $(TEST_DIR) ] [ run ../example/tutorial2/tutorial2.cpp : $(TEST_DIR) ] + [ run ../example/tutorial3/load_self.cpp : : : static_plugin ] ; } diff --git a/test/Jamfile.v2.orig b/test/Jamfile.v2.orig deleted file mode 100644 index 76e6784..0000000 --- a/test/Jamfile.v2.orig +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright Renato Tegon Forti 2011 - 2013. -# 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 - -# bring in rules for testing -import testing ; -import path ; - -path-constant TEST_DIR : $(BOOST_ROOT)/bin.v2/libs/application/test ; - -project - : source-location . - : requirements - - # linux - linux:"-ldl" - - # others - shared:BOOST_ALL_DLL - /boost/system//boost_system - /boost/filesystem//boost_filesystem - multi - - ; -{ - - # our test lib for shared library tests - lib test_library : test_library.cpp ; - lib getting_started_library : ../example/getting_started_library.cpp ; - lib plugin_library : ../example/plugin_library.cpp ; - install install-bin : test_library plugin_library getting_started_library : $(TEST_DIR) ; - - test-suite application - : - [ run shared_library_load_test.cpp : $(TEST_DIR) ] - [ run shared_library_search_symbol_test.cpp : $(TEST_DIR) ] - [ run shared_library_get_symbol_test.cpp : $(TEST_DIR) ] - [ run shared_library_errors.cpp : $(TEST_DIR) : : always_show_run_output ] - [ run ../example/shared_library_load_plugin.cpp : $(TEST_DIR) ] - [ run ../example/getting_started.cpp : $(TEST_DIR) ] - ; -} diff --git a/test/shared_library_get_symbol_test.cpp b/test/shared_library_get_symbol_test.cpp index ef1ce93..917971a 100644 --- a/test/shared_library_get_symbol_test.cpp +++ b/test/shared_library_get_symbol_test.cpp @@ -105,7 +105,7 @@ void refcountable_test(boost::filesystem::path shared_library_path) { } // exe function -extern "C" BOOST_SYMBOL_EXPORT int exef() { +extern "C" int BOOST_SYMBOL_EXPORT exef() { return 15; } diff --git a/test/shared_library_search_symbol_test.cpp b/test/shared_library_search_symbol_test.cpp index 200afe9..95b42cb 100644 --- a/test/shared_library_search_symbol_test.cpp +++ b/test/shared_library_search_symbol_test.cpp @@ -13,7 +13,7 @@ #include "../example/shared_lib_path.hpp" // Unit Tests -extern "C" BOOST_SYMBOL_EXPORT void exef() { +extern "C" void BOOST_SYMBOL_EXPORT exef() { } int test_main(int argc, char* argv[])