summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Tests/Complex/Executable/complex.cxx23
-rw-r--r--Tests/ComplexOneConfig/Executable/complex.cxx23
-rw-r--r--Tests/ComplexRelativePaths/Executable/complex.cxx23
3 files changed, 48 insertions, 21 deletions
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx
index 97e382a..49b439f 100644
--- a/Tests/Complex/Executable/complex.cxx
+++ b/Tests/Complex/Executable/complex.cxx
@@ -112,7 +112,6 @@ int main()
lib += cmDynamicLoader::LibPrefix();
lib += "CMakeTestModule";
lib += cmDynamicLoader::LibExtension();
-
cmLibHandle handle = cmDynamicLoader::OpenLibrary(lib.c_str());
if(!handle)
{
@@ -121,17 +120,27 @@ int main()
else
{
cmDynamicLoaderFunction fun =
- cmDynamicLoader::GetSymbolAddress(handle, "ModuleFunction");
+ cmDynamicLoader::GetSymbolAddress(handle, "ModuleFunction");
+ if(!fun)
+ {
+ fun = cmDynamicLoader::GetSymbolAddress(handle, "_ModuleFunction");
+ }
typedef int (*TEST_FUNCTION)();
TEST_FUNCTION testFun = (TEST_FUNCTION)fun;
- int ret = (*testFun)();
- if(!ret)
+ if(!testFun)
{
- cmFailed("ModuleFunction called from module did not return valid return");
+ cmFailed("Could not find symbol ModuleFunction in library ");
+ }
+ else
+ {
+ int ret = (*testFun)();
+ if(!ret)
+ {
+ cmFailed("ModuleFunction call did not return valid return.");
+ }
+ cmPassed("Module loaded and ModuleFunction called correctly.");
}
- cmPassed("Module loaded and ModuleFunction called correctly");
}
-
if(sharedFunction() != 1)
{
cmFailed("Call to sharedFunction from shared library failed.");
diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx
index 97e382a..49b439f 100644
--- a/Tests/ComplexOneConfig/Executable/complex.cxx
+++ b/Tests/ComplexOneConfig/Executable/complex.cxx
@@ -112,7 +112,6 @@ int main()
lib += cmDynamicLoader::LibPrefix();
lib += "CMakeTestModule";
lib += cmDynamicLoader::LibExtension();
-
cmLibHandle handle = cmDynamicLoader::OpenLibrary(lib.c_str());
if(!handle)
{
@@ -121,17 +120,27 @@ int main()
else
{
cmDynamicLoaderFunction fun =
- cmDynamicLoader::GetSymbolAddress(handle, "ModuleFunction");
+ cmDynamicLoader::GetSymbolAddress(handle, "ModuleFunction");
+ if(!fun)
+ {
+ fun = cmDynamicLoader::GetSymbolAddress(handle, "_ModuleFunction");
+ }
typedef int (*TEST_FUNCTION)();
TEST_FUNCTION testFun = (TEST_FUNCTION)fun;
- int ret = (*testFun)();
- if(!ret)
+ if(!testFun)
{
- cmFailed("ModuleFunction called from module did not return valid return");
+ cmFailed("Could not find symbol ModuleFunction in library ");
+ }
+ else
+ {
+ int ret = (*testFun)();
+ if(!ret)
+ {
+ cmFailed("ModuleFunction call did not return valid return.");
+ }
+ cmPassed("Module loaded and ModuleFunction called correctly.");
}
- cmPassed("Module loaded and ModuleFunction called correctly");
}
-
if(sharedFunction() != 1)
{
cmFailed("Call to sharedFunction from shared library failed.");
diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx
index 97e382a..49b439f 100644
--- a/Tests/ComplexRelativePaths/Executable/complex.cxx
+++ b/Tests/ComplexRelativePaths/Executable/complex.cxx
@@ -112,7 +112,6 @@ int main()
lib += cmDynamicLoader::LibPrefix();
lib += "CMakeTestModule";
lib += cmDynamicLoader::LibExtension();
-
cmLibHandle handle = cmDynamicLoader::OpenLibrary(lib.c_str());
if(!handle)
{
@@ -121,17 +120,27 @@ int main()
else
{
cmDynamicLoaderFunction fun =
- cmDynamicLoader::GetSymbolAddress(handle, "ModuleFunction");
+ cmDynamicLoader::GetSymbolAddress(handle, "ModuleFunction");
+ if(!fun)
+ {
+ fun = cmDynamicLoader::GetSymbolAddress(handle, "_ModuleFunction");
+ }
typedef int (*TEST_FUNCTION)();
TEST_FUNCTION testFun = (TEST_FUNCTION)fun;
- int ret = (*testFun)();
- if(!ret)
+ if(!testFun)
{
- cmFailed("ModuleFunction called from module did not return valid return");
+ cmFailed("Could not find symbol ModuleFunction in library ");
+ }
+ else
+ {
+ int ret = (*testFun)();
+ if(!ret)
+ {
+ cmFailed("ModuleFunction call did not return valid return.");
+ }
+ cmPassed("Module loaded and ModuleFunction called correctly.");
}
- cmPassed("Module loaded and ModuleFunction called correctly");
}
-
if(sharedFunction() != 1)
{
cmFailed("Call to sharedFunction from shared library failed.");