ENH: Added function call argument to module function to make sure calling convention matches on lookup. Fixed for Watcom.

This commit is contained in:
Brad King 2007-04-19 11:32:43 -04:00
parent 16be80b7b4
commit 03dfb39bd0
2 changed files with 14 additions and 4 deletions

View File

@ -44,8 +44,12 @@ int main()
<< kwsys_ios::endl; << kwsys_ios::endl;
return 1; return 1;
} }
int(*f)() = reinterpret_cast<int(*)()>(sym); #ifdef __WATCOMC__
if(f() != (123+456)) 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::cerr << "Incorrect return value from plugin!"
<< kwsys_ios::endl; << kwsys_ios::endl;

View File

@ -8,9 +8,15 @@
# define MODULE_EXPORT # define MODULE_EXPORT
#endif #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"); printf("world\n");
return result; return result;
} }