X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=include%2Fncurses_dll.h.in;h=437c54de0271560d58c112a65f096e7dd67016dc;hp=64f1a894abdc7f18196880f60c36a76f18ee810f;hb=265e45e43e9917e8b9ecc2bf9d23867a3ede2ecd;hpb=18f51bcf99101e5bf4c737239c44064227f34db8 diff --git a/include/ncurses_dll.h.in b/include/ncurses_dll.h.in index 64f1a894..437c54de 100644 --- a/include/ncurses_dll.h.in +++ b/include/ncurses_dll.h.in @@ -26,7 +26,7 @@ * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ -/* $Id: ncurses_dll.h.in,v 1.13 2020/02/29 21:53:14 tom Exp $ */ +/* $Id: ncurses_dll.h.in,v 1.17 2020/09/05 17:58:47 juergen Exp $ */ #ifndef NCURSES_DLL_H_incl #define NCURSES_DLL_H_incl 1 @@ -66,52 +66,34 @@ * using functions to access them. */ #define NCURSES_PUBLIC_VAR(name) @NCURSES_WRAP_PREFIX@##name -#define NCURSES_WRAPPED_VAR(type,name) extern NCURSES_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) - -/* no longer needed on cygwin or mingw, thanks to auto-import */ -/* but this structure may be useful at some point for an MSVC build */ -/* so, for now unconditionally define the important flags */ -/* "the right way" for proper static and dll+auto-import behavior */ -#undef NCURSES_DLL -#define NCURSES_STATIC -#if defined(__CYGWIN__) || defined(_WIN32) -# if defined(NCURSES_DLL) -# if defined(NCURSES_STATIC) -# undef NCURSES_STATIC -# endif -# endif -# undef NCURSES_IMPEXP -# undef NCURSES_API -# undef NCURSES_EXPORT -# undef NCURSES_EXPORT_VAR -# if defined(NCURSES_DLL) -/* building a DLL */ -# define NCURSES_IMPEXP __declspec(dllexport) -# elif defined(NCURSES_STATIC) -/* building or linking to a static library */ -# define NCURSES_IMPEXP /* nothing */ -# else -/* linking to the DLL */ -# define NCURSES_IMPEXP __declspec(dllimport) -# endif -# define NCURSES_API __cdecl -# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API -# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#if defined(BUILDING_NCURSES) +# define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT +#else +# define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT #endif -/* Take care of non-cygwin platforms */ -#if !defined(NCURSES_IMPEXP) -# define NCURSES_IMPEXP /* nothing */ -#endif -#if !defined(NCURSES_API) -# define NCURSES_API /* nothing */ -#endif -#if !defined(NCURSES_EXPORT) -# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API -#endif -#if !defined(NCURSES_EXPORT_VAR) -# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#define NCURSES_WRAPPED_VAR(type,name) extern NCURSES_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) + +#define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type + +/* + * These symbols hide dllimport/dllexport, for compilers which care about it. + */ +#if defined(__CYGWIN__) || (defined(_WIN32) || defined(_WIN64)) +# if defined(NCURSES_STATIC) /* "static" here only implies "not-a-DLL" */ +# define NCURSES_EXPORT_GENERAL_IMPORT +# define NCURSES_EXPORT_GENERAL_EXPORT +# else +# define NCURSES_EXPORT_GENERAL_IMPORT __declspec(dllimport) +# define NCURSES_EXPORT_GENERAL_EXPORT __declspec(dllexport) +# endif +# define NCURSES_API __cdecl +#else +# define NCURSES_EXPORT_GENERAL_IMPORT +# define NCURSES_EXPORT_GENERAL_EXPORT +# define NCURSES_API /* FIXME: __attribute__ ((cdecl)) is only available on x86 */ #endif #endif /* NCURSES_DLL_H_incl */