]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - include/ncurses_dll.h.in
ncurses 6.2 - patch 20200801
[ncurses.git] / include / ncurses_dll.h.in
index 469ab580618b4c17d4510f0217561b54a5ae967d..ac351e7ca7c51bd6985385ffdcd5afe115794ef0 100644 (file)
@@ -26,7 +26,7 @@
  * sale, use or other dealings in this Software without prior written       *
  * authorization.                                                           *
  ****************************************************************************/
-/* $Id: ncurses_dll.h.in,v 1.15 2020/04/04 23:37:36 tom Exp $ */
+/* $Id: ncurses_dll.h.in,v 1.16 2020/07/04 23:07:54 tom Exp $ */
 
 #ifndef NCURSES_DLL_H_incl
 #define NCURSES_DLL_H_incl 1
  * using functions to access them.
  */
 #define NCURSES_PUBLIC_VAR(name) @NCURSES_WRAP_PREFIX@##name
+
+#if defined(BUILDING_NCURSES)
+# define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
+#else
+# define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
+#endif
+
 #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
+#define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
+#define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
 
 /*
- * These are configurable:
+ * These symbols hide dllimport/dllexport, for compilers which care about it.
  */
-#undef NCURSES_API
-#undef NCURSES_CXX_IMPEXP
-#undef NCURSES_EXPORT
-#undef NCURSES_EXPORT_VAR
-#undef NCURSES_IMPEXP
-
 #if defined(__CYGWIN__) || defined(_WIN32)
-#  if defined(NCURSES_DLL)
-#    if defined(NCURSES_STATIC)
-#      undef NCURSES_STATIC
-#    endif
-#  endif
-#  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
-#endif
-
-/* Take care of non-Windows platforms */
-#if !defined(NCURSES_IMPEXP)
-#  define NCURSES_IMPEXP @NCURSES_IMPEXP@
-#endif
-#if !defined(NCURSES_CXX_IMPEXP)
-#  define NCURSES_CXX_IMPEXP @NCURSES_CXX_IMPEXP@
-#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
+# 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 */