ncurses_dll.h 4.2 KB

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