summaryrefslogtreecommitdiffstats
path: root/Tests/Plugin
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-04-19 15:32:43 (GMT)
committerBrad King <brad.king@kitware.com>2007-04-19 15:32:43 (GMT)
commit03dfb39bd0b0fa8e958f0fed00cdf44133d936d1 (patch)
tree2a868286b21664aa33cb2a91146212da949d2cf2 /Tests/Plugin
parent16be80b7b49ee02019eeaf8710028d90be8d368e (diff)
downloadCMake-03dfb39bd0b0fa8e958f0fed00cdf44133d936d1.zip
CMake-03dfb39bd0b0fa8e958f0fed00cdf44133d936d1.tar.gz
CMake-03dfb39bd0b0fa8e958f0fed00cdf44133d936d1.tar.bz2
ENH: Added function call argument to module function to make sure calling convention matches on lookup. Fixed for Watcom.
Diffstat (limited to 'Tests/Plugin')
-rw-r--r--Tests/Plugin/src/example_exe.cxx8
-rw-r--r--Tests/Plugin/src/example_mod_1.c10
2 files changed, 14 insertions, 4 deletions
diff --git a/Tests/Plugin/src/example_exe.cxx b/Tests/Plugin/src/example_exe.cxx
index 96566d5..df7b2a0 100644
--- a/Tests/Plugin/src/example_exe.cxx
+++ b/Tests/Plugin/src/example_exe.cxx
@@ -44,8 +44,12 @@ int main()
<< kwsys_ios::endl;
return 1;
}
- int(*f)() = reinterpret_cast<int(*)()>(sym);
- if(f() != (123+456))
+#ifdef __WATCOMC__
+ int(__cdecl *f)(int) = (int(__cdecl *)(int))(sym);
+#else
+ int(*f)(int) = reinterpret_cast<int(*)(int)>(sym);
+#endif
+ if(f(456) != (123+456))
{
kwsys_ios::cerr << "Incorrect return value from plugin!"
<< kwsys_ios::endl;
diff --git a/Tests/Plugin/src/example_mod_1.c b/Tests/Plugin/src/example_mod_1.c
index f96ba29..1fc7338 100644
--- a/Tests/Plugin/src/example_mod_1.c
+++ b/Tests/Plugin/src/example_mod_1.c
@@ -8,9 +8,15 @@
# define MODULE_EXPORT
#endif
-MODULE_EXPORT int example_mod_1_function()
+#ifdef __WATCOMC__
+# define MODULE_CCONV __cdecl
+#else
+# define MODULE_CCONV
+#endif
+
+MODULE_EXPORT int MODULE_CCONV example_mod_1_function(int n)
{
- int result = example_exe_function() + 456;
+ int result = example_exe_function() + n;
printf("world\n");
return result;
}