From 2f74efdb0a7ca8a037a70b603700ee950d792db9 Mon Sep 17 00:00:00 2001 From: Bryce Denney Date: Fri, 11 Oct 2002 15:59:21 +0000 Subject: [PATCH] - rewrite DLL macros, now somewhat closer to how LT_SCOPE is written in . Now go back to Linux and test. --- .../plugin-test/test2-dynamic/Makefile | 4 ++-- .../plugin-test/test2-dynamic/module1.cc | 8 +------- .../plugin-test/test2-dynamic/module1.h | 18 +++++++++++++----- .../plugin-test/test2-dynamic/uselib.cc | 1 + 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/bochs-testing/plugin-test/test2-dynamic/Makefile b/bochs-testing/plugin-test/test2-dynamic/Makefile index 460bf71d4..8f40d1d54 100644 --- a/bochs-testing/plugin-test/test2-dynamic/Makefile +++ b/bochs-testing/plugin-test/test2-dynamic/Makefile @@ -1,5 +1,5 @@ CXX=g++ -CXXFLAGS=-Wall -g +CXXFLAGS=-Wall -g -mno-cygwin LIBTOOL=libtool RPATH=`pwd`/lib @@ -13,7 +13,7 @@ libmodule1.la: module1.lo mkdir -p lib bin $(LIBTOOL) cp libmodule1.la ${RPATH} -%.lo: %.cc +%.lo: %.cc %.h $(LIBTOOL) $(CXX) -c $< clean: diff --git a/bochs-testing/plugin-test/test2-dynamic/module1.cc b/bochs-testing/plugin-test/test2-dynamic/module1.cc index 626a3f406..507c9ffc7 100644 --- a/bochs-testing/plugin-test/test2-dynamic/module1.cc +++ b/bochs-testing/plugin-test/test2-dynamic/module1.cc @@ -1,10 +1,4 @@ -// 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 - +#define MODULE1_DLL_EXPORT #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 a489aea8a..88de9c70b 100644 --- a/bochs-testing/plugin-test/test2-dynamic/module1.h +++ b/bochs-testing/plugin-test/test2-dynamic/module1.h @@ -1,10 +1,18 @@ -#ifndef MODULE1API -# if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) -# define MODULE1API(type) __declspec(dllimport) type __cdecl -# else -# define MODULE1API(type) type +#if defined(WIN32) || defined(__CYGWIN__) +# if defined(MODULE1_DLL_EXPORT) && defined(DLL_EXPORT) +# warning case 1 +# define MODULE1API(type) __declspec(dllexport) type +# endif +# ifdef MODULE1_DLL_IMPORT +# warning case 2 +# define MODULE1API(type) __declspec(dllimport) type # endif #endif +#ifndef MODULE1API +# warning case 3 +# define MODULE1API(type) type +#endif + MODULE1API(extern const char *) module_name; MODULE1API(extern int) operate (int a, int b); diff --git a/bochs-testing/plugin-test/test2-dynamic/uselib.cc b/bochs-testing/plugin-test/test2-dynamic/uselib.cc index ae079ba1e..1548fc3f4 100644 --- a/bochs-testing/plugin-test/test2-dynamic/uselib.cc +++ b/bochs-testing/plugin-test/test2-dynamic/uselib.cc @@ -1,4 +1,5 @@ #include +#define MODULE1_DLL_IMPORT #include "module1.h" int main ()