xref: /freebsd/contrib/ncurses/include/ncurses_dll.h.in (revision 39ee7a7a6bdd1557b1c3532abf60d139798ac88b)
1/****************************************************************************
2 * Copyright (c) 1998-2007,2009 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.8 2009/04/04 22:26:27 tom Exp $ */
29
30#ifndef NCURSES_DLL_H_incl
31#define NCURSES_DLL_H_incl 1
32
33/*
34 * For reentrant code, we map the various global variables into SCREEN by
35 * using functions to access them.
36 */
37#define NCURSES_PUBLIC_VAR(name) @NCURSES_WRAP_PREFIX@##name
38#define NCURSES_WRAPPED_VAR(type,name) extern type NCURSES_PUBLIC_VAR(name)(void)
39
40/* no longer needed on cygwin or mingw, thanks to auto-import       */
41/* but this structure may be useful at some point for an MSVC build */
42/* so, for now unconditionally define the important flags           */
43/* "the right way" for proper static and dll+auto-import behavior   */
44#undef NCURSES_DLL
45#define NCURSES_STATIC
46
47#if defined(__CYGWIN__) || defined(__MINGW32__)
48#  if defined(NCURSES_DLL)
49#    if defined(NCURSES_STATIC)
50#      undef NCURSES_STATIC
51#    endif
52#  endif
53#  undef NCURSES_IMPEXP
54#  undef NCURSES_API
55#  undef NCURSES_EXPORT
56#  undef NCURSES_EXPORT_VAR
57#  if defined(NCURSES_DLL)
58/* building a DLL */
59#    define NCURSES_IMPEXP __declspec(dllexport)
60#  elif defined(NCURSES_STATIC)
61/* building or linking to a static library */
62#    define NCURSES_IMPEXP /* nothing */
63#  else
64/* linking to the DLL */
65#    define NCURSES_IMPEXP __declspec(dllimport)
66#  endif
67#  define NCURSES_API __cdecl
68#  define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
69#  define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
70#endif
71
72/* Take care of non-cygwin platforms */
73#if !defined(NCURSES_IMPEXP)
74#  define NCURSES_IMPEXP /* nothing */
75#endif
76#if !defined(NCURSES_API)
77#  define NCURSES_API /* nothing */
78#endif
79#if !defined(NCURSES_EXPORT)
80#  define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
81#endif
82#if !defined(NCURSES_EXPORT_VAR)
83#  define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
84#endif
85
86#endif /* NCURSES_DLL_H_incl */
87