diff --git a/bochs-testing/plugin-test/test2-dynamic/module1.cc b/bochs-testing/plugin-test/test2-dynamic/module1.cc index 5b2984c4a..626a3f406 100644 --- a/bochs-testing/plugin-test/test2-dynamic/module1.cc +++ b/bochs-testing/plugin-test/test2-dynamic/module1.cc @@ -1,4 +1,10 @@ -#define DLLINTERFACE __declspec(dllexport) +// set up MODULE1API macro for DLL export +#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) +# define MODULE1API(type) __declspec(dllexport) type __cdecl +#else +# define MODULE1API(type) type +#endif + #include "module1.h" const char *module_name = "AddModule"; diff --git a/bochs-testing/plugin-test/test2-dynamic/module1.h b/bochs-testing/plugin-test/test2-dynamic/module1.h index d5b6636a6..a489aea8a 100644 --- a/bochs-testing/plugin-test/test2-dynamic/module1.h +++ b/bochs-testing/plugin-test/test2-dynamic/module1.h @@ -1,6 +1,10 @@ -#ifndef DLLINTERFACE -#define DLLINTERFACE __declspec(dllimport) +#ifndef MODULE1API +# if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) +# define MODULE1API(type) __declspec(dllimport) type __cdecl +# else +# define MODULE1API(type) type +# endif #endif -DLLINTERFACE extern const char * module_name; -DLLINTERFACE extern int operate (int a, int b); +MODULE1API(extern const char *) module_name; +MODULE1API(extern int) operate (int a, int b); diff --git a/bochs-testing/plugin-test/test3-twomodules/module1.cc b/bochs-testing/plugin-test/test3-twomodules/module1.cc index 1f3cb54b0..889b244c4 100644 --- a/bochs-testing/plugin-test/test3-twomodules/module1.cc +++ b/bochs-testing/plugin-test/test3-twomodules/module1.cc @@ -1,6 +1,11 @@ -#define DLLINTERFACE __declspec(dllexport) +// set up MODULE1API macro for DLL export +#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) +# define MODULE1API(type) __declspec(dllexport) type __cdecl +#else +# define MODULE1API(type) type +#endif + #include "module1.h" -#undef DLLINTERFACE #include "module2.h" const char *module_name = "AddModule"; diff --git a/bochs-testing/plugin-test/test3-twomodules/module1.h b/bochs-testing/plugin-test/test3-twomodules/module1.h index ee9f30df6..8510c8d48 100644 --- a/bochs-testing/plugin-test/test3-twomodules/module1.h +++ b/bochs-testing/plugin-test/test3-twomodules/module1.h @@ -1,7 +1,11 @@ -#ifndef DLLINTERFACE -#define DLLINTERFACE __declspec(dllimport) +#ifndef MODULE1API +# if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) +# define MODULE1API(type) __declspec(dllimport) type __cdecl +# else +# define MODULE1API(type) type +# endif #endif -DLLINTERFACE extern const char * module_name; -DLLINTERFACE extern int operate (int a, int b); +MODULE1API(extern const char *) module_name; +MODULE1API(extern int) operate (int a, int b); diff --git a/bochs-testing/plugin-test/test3-twomodules/module2.cc b/bochs-testing/plugin-test/test3-twomodules/module2.cc index 2c1d51dee..6b5a51d43 100644 --- a/bochs-testing/plugin-test/test3-twomodules/module2.cc +++ b/bochs-testing/plugin-test/test3-twomodules/module2.cc @@ -1,8 +1,12 @@ -#include +// set up MODULE2API macro for DLL export +#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) +# define MODULE2API(type) __declspec(dllexport) type __cdecl +#else +# define MODULE2API(type) type +#endif -#define DLLINTERFACE __declspec(dllexport) +#include #include "module2.h" -#undef DLLINTERFACE int n_operations = 0; diff --git a/bochs-testing/plugin-test/test3-twomodules/module2.h b/bochs-testing/plugin-test/test3-twomodules/module2.h index 84e80e425..52c4ae86a 100644 --- a/bochs-testing/plugin-test/test3-twomodules/module2.h +++ b/bochs-testing/plugin-test/test3-twomodules/module2.h @@ -1,7 +1,11 @@ -#ifndef DLLINTERFACE -#define DLLINTERFACE __declspec(dllimport) +#ifndef MODULE2API +# if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) +# define MODULE2API(type) __declspec(dllimport) type __cdecl +# else +# define MODULE2API(type) type +# endif #endif -DLLINTERFACE extern int n_operations; -DLLINTERFACE void operation_occurred (); +MODULE2API(extern int) n_operations; +MODULE2API(void) operation_occurred (); diff --git a/bochs-testing/plugin-test/test4-interdep/module1.cc b/bochs-testing/plugin-test/test4-interdep/module1.cc index ef5d2dc78..9ae0750b2 100644 --- a/bochs-testing/plugin-test/test4-interdep/module1.cc +++ b/bochs-testing/plugin-test/test4-interdep/module1.cc @@ -1,6 +1,11 @@ -#define DLLINTERFACE __declspec(dllexport) +// set up MODULE1API macro for DLL export +#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) +# define MODULE1API(type) __declspec(dllexport) type __cdecl +#else +# define MODULE1API(type) type +#endif + #include "module1.h" -#undef DLLINTERFACE #include "module2.h" const char *module_name = "AddModule"; diff --git a/bochs-testing/plugin-test/test4-interdep/module1.h b/bochs-testing/plugin-test/test4-interdep/module1.h index ee9f30df6..8510c8d48 100644 --- a/bochs-testing/plugin-test/test4-interdep/module1.h +++ b/bochs-testing/plugin-test/test4-interdep/module1.h @@ -1,7 +1,11 @@ -#ifndef DLLINTERFACE -#define DLLINTERFACE __declspec(dllimport) +#ifndef MODULE1API +# if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) +# define MODULE1API(type) __declspec(dllimport) type __cdecl +# else +# define MODULE1API(type) type +# endif #endif -DLLINTERFACE extern const char * module_name; -DLLINTERFACE extern int operate (int a, int b); +MODULE1API(extern const char *) module_name; +MODULE1API(extern int) operate (int a, int b); diff --git a/bochs-testing/plugin-test/test4-interdep/module2.cc b/bochs-testing/plugin-test/test4-interdep/module2.cc index 2c1d51dee..6b5a51d43 100644 --- a/bochs-testing/plugin-test/test4-interdep/module2.cc +++ b/bochs-testing/plugin-test/test4-interdep/module2.cc @@ -1,8 +1,12 @@ -#include +// set up MODULE2API macro for DLL export +#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) +# define MODULE2API(type) __declspec(dllexport) type __cdecl +#else +# define MODULE2API(type) type +#endif -#define DLLINTERFACE __declspec(dllexport) +#include #include "module2.h" -#undef DLLINTERFACE int n_operations = 0; diff --git a/bochs-testing/plugin-test/test4-interdep/module2.h b/bochs-testing/plugin-test/test4-interdep/module2.h index 84e80e425..6b71cb944 100644 --- a/bochs-testing/plugin-test/test4-interdep/module2.h +++ b/bochs-testing/plugin-test/test4-interdep/module2.h @@ -1,7 +1,10 @@ -#ifndef DLLINTERFACE -#define DLLINTERFACE __declspec(dllimport) +#ifndef MODULE2API +# if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) +# define MODULE2API(type) __declspec(dllimport) type __cdecl +# else +# define MODULE2API(type) type +# endif #endif -DLLINTERFACE extern int n_operations; -DLLINTERFACE void operation_occurred (); - +MODULE2API(extern int) n_operations; +MODULE2API(void) operation_occurred ();