diff options
author | enge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2011-11-03 19:39:33 +0000 |
---|---|---|
committer | enge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2011-11-03 19:39:33 +0000 |
commit | 42c8f0135fab40c6f70d97f16f3e8fcd127dcec6 (patch) | |
tree | 30030d0a926714389751f127b0a085bc82fec82b | |
parent | cd2581b4c05b828889d2011c89100d0934dc3875 (diff) | |
download | mpc-42c8f0135fab40c6f70d97f16f3e8fcd127dcec6.tar.gz |
mpc.h. mpc-tests.h, mpc-impl.h: handle __MPC_DECLSPEC as for mpfr;
define as __GMP_DECLSPEC_EXPORT if library is compiled and __GMP_LIBGMP_DLL,
as in gmp otherwise
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@1109 211d60ee-9f03-0410-a15a-8952a2c7a4e4
-rw-r--r-- | src/mpc-impl.h | 7 | ||||
-rw-r--r-- | src/mpc.h | 10 | ||||
-rw-r--r-- | tests/mpc-tests.h | 6 |
3 files changed, 19 insertions, 4 deletions
diff --git a/src/mpc-impl.h b/src/mpc-impl.h index baa7a72..88a49d8 100644 --- a/src/mpc-impl.h +++ b/src/mpc-impl.h @@ -21,6 +21,13 @@ along with this program. If not, see http://www.gnu.org/licenses/ . #ifndef __MPC_IMPL_H #define __MPC_IMPL_H +/* If mpc-impl.h is included, we are either in the library build or in the + tests. Define __MPC_WITHIN_MPC in the first case, since Windows DLL needs + different export/import directives. Without effect outside Windows DLL. */ +#ifndef __MPC_TESTS_H +#define __MPC_WITHIN_MPC 1 +#endif + #include <stdlib.h> #include "config.h" #include "mpc.h" @@ -120,7 +120,15 @@ typedef __gmp_const __mpc_struct *mpc_srcptr; # define __MPC_PROTO(x) () #endif -/* Support for WINDOWS DLL, see the thread http://lists.gforge.inria.fr/pipermail/mpc-discuss/2011-April/000871.html */ +/* Support for WINDOWS DLL, see + http://lists.gforge.inria.fr/pipermail/mpc-discuss/2011-November/000990.html; + when building the DLL, export symbols, otherwise behave as GMP */ +#if defined (__MPC_WITHIN_MPC) && __GMP_LIBGMP_DLL +#define __MPC_DECLSPEC __GMP_DECLSPEC_EXPORT +#else +#define __MPC_DECLSPEC __GMP_DECLSPEC +#endif + #if __GMP_LIBGMP_DLL # define __MPC_DECLSPEC __GMP_DECLSPEC_EXPORT #else diff --git a/tests/mpc-tests.h b/tests/mpc-tests.h index b437ddf..c0f7c46 100644 --- a/tests/mpc-tests.h +++ b/tests/mpc-tests.h @@ -18,8 +18,8 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/ . */ -#ifndef MPC_TESTS_H -#define MPC_TESTS_H +#ifndef __MPC_TESTS_H +#define __MPC_TESTS_H #include <stdio.h> #include <ctype.h> @@ -188,4 +188,4 @@ extern void read_mpc (FILE *fp, mpc_ptr z, known_signs_t *ks); #define TERNARY_ERROR 254 /* special value to indicate that an error occurred in an mpc function */ -#endif /* MPC_TESTS_H */ +#endif /* __MPC_TESTS_H */ |