summaryrefslogtreecommitdiffstats
path: root/Tests/Plugin/src/example_exe.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-09-19 14:10:52 (GMT)
committerBrad King <brad.king@kitware.com>2019-09-19 14:42:51 (GMT)
commitc578caa68bf7ee55077a3efa25aba46e9e1f562a (patch)
tree7609ec94c8bb5e13e018b3d8fc08b3e362afea5b /Tests/Plugin/src/example_exe.cxx
parent56879273dc87a69e1d1491a73e0f74cd4424494c (diff)
downloadCMake-c578caa68bf7ee55077a3efa25aba46e9e1f562a.zip
CMake-c578caa68bf7ee55077a3efa25aba46e9e1f562a.tar.gz
CMake-c578caa68bf7ee55077a3efa25aba46e9e1f562a.tar.bz2
Tests: Decouple Plugin test from KWSys
KWSys now requires C++11 but we want this test to be able to run as C++98. Copy the KWSys DynamicLoader implementation (with original notice headers and license reference) and update it to work alone.
Diffstat (limited to 'Tests/Plugin/src/example_exe.cxx')
-rw-r--r--Tests/Plugin/src/example_exe.cxx17
1 files changed, 7 insertions, 10 deletions
diff --git a/Tests/Plugin/src/example_exe.cxx b/Tests/Plugin/src/example_exe.cxx
index 257a35c..fd810a9 100644
--- a/Tests/Plugin/src/example_exe.cxx
+++ b/Tests/Plugin/src/example_exe.cxx
@@ -1,4 +1,4 @@
-#include <kwsys/DynamicLoader.hxx>
+#include "DynamicLoader.hxx"
#include <example.h>
@@ -24,20 +24,17 @@ extern "C" int example_exe_function()
int main()
{
- std::string libName = EXAMPLE_EXE_PLUGIN_DIR CONFIG_DIR "/";
- libName += kwsys::DynamicLoader::LibPrefix();
- libName += "example_mod_1";
- libName += kwsys::DynamicLoader::LibExtension();
- kwsys::DynamicLoader::LibraryHandle handle =
- kwsys::DynamicLoader::OpenLibrary(libName.c_str());
+ std::string const libName = EXAMPLE_EXE_PLUGIN_DIR CONFIG_DIR
+ "/" EXAMPLE_EXE_MOD_PREFIX "example_mod_1" EXAMPLE_EXE_MOD_SUFFIX;
+ DynamicLoader::LibraryHandle handle = DynamicLoader::OpenLibrary(libName);
if (!handle) {
// Leave the .c_str() on this one. It is needed on OpenWatcom.
std::cerr << "Could not open plugin \"" << libName.c_str() << "\"!"
<< std::endl;
return 1;
}
- kwsys::DynamicLoader::SymbolPointer sym =
- kwsys::DynamicLoader::GetSymbolAddress(handle, "example_mod_1_function");
+ DynamicLoader::SymbolPointer sym =
+ DynamicLoader::GetSymbolAddress(handle, "example_mod_1_function");
if (!sym) {
std::cerr << "Could not get plugin symbol \"example_mod_1_function\"!"
<< std::endl;
@@ -52,6 +49,6 @@ int main()
std::cerr << "Incorrect return value from plugin!" << std::endl;
return 1;
}
- kwsys::DynamicLoader::CloseLibrary(handle);
+ DynamicLoader::CloseLibrary(handle);
return 0;
}