ncurses_dll.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /****************************************************************************
  2. * Copyright 2018,2020 Thomas E. Dickey *
  3. * Copyright 2009,2014 Free Software Foundation, Inc. *
  4. * *
  5. * Permission is hereby granted, free of charge, to any person obtaining a *
  6. * copy of this software and associated documentation files (the *
  7. * "Software"), to deal in the Software without restriction, including *
  8. * without limitation the rights to use, copy, modify, merge, publish, *
  9. * distribute, distribute with modifications, sublicense, and/or sell *
  10. * copies of the Software, and to permit persons to whom the Software is *
  11. * furnished to do so, subject to the following conditions: *
  12. * *
  13. * The above copyright notice and this permission notice shall be included *
  14. * in all copies or substantial portions of the Software. *
  15. * *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
  17. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
  18. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
  19. * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
  20. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
  21. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
  22. * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
  23. * *
  24. * Except as contained in this notice, the name(s) of the above copyright *
  25. * holders shall not be used in advertising or otherwise to promote the *
  26. * sale, use or other dealings in this Software without prior written *
  27. * authorization. *
  28. ****************************************************************************/
  29. /* $Id: ncurses_dll.h.in,v 1.12 2020/02/02 23:34:34 tom Exp $ */
  30. #ifndef NCURSES_DLL_H_incl
  31. #define NCURSES_DLL_H_incl 1
  32. /*
  33. * MinGW gcc (unlike MSYS2 and Cygwin) should define _WIN32 and possibly _WIN64.
  34. */
  35. #if defined(__MINGW64__)
  36. #ifndef _WIN64
  37. #define _WIN64 1
  38. #endif
  39. #elif defined(__MINGW32__)
  40. #ifndef _WIN32
  41. #define _WIN32 1
  42. #endif
  43. /* 2014-08-02 workaround for broken MinGW compiler.
  44. * Oddly, only TRACE is mapped to trace - the other -D's are okay.
  45. * suggest TDM as an alternative.
  46. */
  47. #if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
  48. #ifdef trace
  49. #undef trace
  50. #define TRACE
  51. #endif
  52. #endif /* broken compiler */
  53. #endif /* MingW */
  54. /*
  55. * For reentrant code, we map the various global variables into SCREEN by
  56. * using functions to access them.
  57. */
  58. #define NCURSES_PUBLIC_VAR(name) _nc_##name
  59. #define NCURSES_WRAPPED_VAR(type,name) extern type NCURSES_PUBLIC_VAR(name)(void)
  60. /* no longer needed on cygwin or mingw, thanks to auto-import */
  61. /* but this structure may be useful at some point for an MSVC build */
  62. /* so, for now unconditionally define the important flags */
  63. /* "the right way" for proper static and dll+auto-import behavior */
  64. #undef NCURSES_DLL
  65. #define NCURSES_STATIC
  66. #if defined(__CYGWIN__) || defined(_WIN32)
  67. # if defined(NCURSES_DLL)
  68. # if defined(NCURSES_STATIC)
  69. # undef NCURSES_STATIC
  70. # endif
  71. # endif
  72. # undef NCURSES_IMPEXP
  73. # undef NCURSES_API
  74. # undef NCURSES_EXPORT
  75. # undef NCURSES_EXPORT_VAR
  76. # if defined(NCURSES_DLL)
  77. /* building a DLL */
  78. # define NCURSES_IMPEXP __declspec(dllexport)
  79. # elif defined(NCURSES_STATIC)
  80. /* building or linking to a static library */
  81. # define NCURSES_IMPEXP /* nothing */
  82. # else
  83. /* linking to the DLL */
  84. # define NCURSES_IMPEXP __declspec(dllimport)
  85. # endif
  86. # define NCURSES_API __cdecl
  87. # define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
  88. # define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
  89. #endif
  90. /* Take care of non-cygwin platforms */
  91. #if !defined(NCURSES_IMPEXP)
  92. # define NCURSES_IMPEXP /* nothing */
  93. #endif
  94. #if !defined(NCURSES_API)
  95. # define NCURSES_API /* nothing */
  96. #endif
  97. #if !defined(NCURSES_EXPORT)
  98. # define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
  99. #endif
  100. #if !defined(NCURSES_EXPORT_VAR)
  101. # define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
  102. #endif
  103. #endif /* NCURSES_DLL_H_incl */