]> ncurses.scripts.mit.edu Git - ncurses.git/blob - include/ncurses_dll.h.in
ncurses 6.1 - patch 20190126
[ncurses.git] / include / ncurses_dll.h.in
1 /****************************************************************************
2  * Copyright (c) 1998-2014,2018 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.11 2018/06/23 21:38:14 tom Exp $ */
29
30 #ifndef NCURSES_DLL_H_incl
31 #define NCURSES_DLL_H_incl 1
32
33 /*
34  * MinGW gcc (unlike MSYS2 and Cygwin) should define _WIN32 and possibly _WIN64.
35  */
36 #if defined(__MINGW64__)
37
38 #ifndef _WIN64
39 #define _WIN64 1
40 #endif
41
42 #elif defined(__MINGW32__)
43
44 #ifndef _WIN32
45 #define _WIN32 1
46 #endif
47
48 /* 2014-08-02 workaround for broken MinGW compiler.
49  * Oddly, only TRACE is mapped to trace - the other -D's are okay.
50  * suggest TDM as an alternative.
51  */
52 #if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
53
54 #ifdef trace
55 #undef trace
56 #define TRACE
57 #endif
58
59 #endif  /* broken compiler */
60
61 #endif  /* MingW */
62
63 /*
64  * For reentrant code, we map the various global variables into SCREEN by
65  * using functions to access them.
66  */
67 #define NCURSES_PUBLIC_VAR(name) @NCURSES_WRAP_PREFIX@##name
68 #define NCURSES_WRAPPED_VAR(type,name) extern type NCURSES_PUBLIC_VAR(name)(void)
69
70 /* no longer needed on cygwin or mingw, thanks to auto-import       */
71 /* but this structure may be useful at some point for an MSVC build */
72 /* so, for now unconditionally define the important flags           */
73 /* "the right way" for proper static and dll+auto-import behavior   */
74 #undef NCURSES_DLL
75 #define NCURSES_STATIC
76
77 #if defined(__CYGWIN__) || defined(_WIN32)
78 #  if defined(NCURSES_DLL)
79 #    if defined(NCURSES_STATIC)
80 #      undef NCURSES_STATIC
81 #    endif
82 #  endif
83 #  undef NCURSES_IMPEXP
84 #  undef NCURSES_API
85 #  undef NCURSES_EXPORT
86 #  undef NCURSES_EXPORT_VAR
87 #  if defined(NCURSES_DLL)
88 /* building a DLL */
89 #    define NCURSES_IMPEXP __declspec(dllexport)
90 #  elif defined(NCURSES_STATIC)
91 /* building or linking to a static library */
92 #    define NCURSES_IMPEXP /* nothing */
93 #  else
94 /* linking to the DLL */
95 #    define NCURSES_IMPEXP __declspec(dllimport)
96 #  endif
97 #  define NCURSES_API __cdecl
98 #  define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
99 #  define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
100 #endif
101
102 /* Take care of non-cygwin platforms */
103 #if !defined(NCURSES_IMPEXP)
104 #  define NCURSES_IMPEXP /* nothing */
105 #endif
106 #if !defined(NCURSES_API)
107 #  define NCURSES_API /* nothing */
108 #endif
109 #if !defined(NCURSES_EXPORT)
110 #  define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
111 #endif
112 #if !defined(NCURSES_EXPORT_VAR)
113 #  define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
114 #endif
115
116 #endif /* NCURSES_DLL_H_incl */