xref: /freebsd/contrib/ncurses/include/ncurses_dll.h.in (revision 21817992b3314c908ab50f0bb88d2ee750b9c4ac)
106bfebdeSXin LI/****************************************************************************
2*21817992SBaptiste Daroussin * Copyright 2018-2020,2023 Thomas E. Dickey                                *
3e1865124SBaptiste Daroussin * Copyright 2009,2014 Free Software Foundation, Inc.                       *
406bfebdeSXin LI *                                                                          *
506bfebdeSXin LI * Permission is hereby granted, free of charge, to any person obtaining a  *
606bfebdeSXin LI * copy of this software and associated documentation files (the            *
706bfebdeSXin LI * "Software"), to deal in the Software without restriction, including      *
806bfebdeSXin LI * without limitation the rights to use, copy, modify, merge, publish,      *
906bfebdeSXin LI * distribute, distribute with modifications, sublicense, and/or sell       *
1006bfebdeSXin LI * copies of the Software, and to permit persons to whom the Software is    *
1106bfebdeSXin LI * furnished to do so, subject to the following conditions:                 *
1206bfebdeSXin LI *                                                                          *
1306bfebdeSXin LI * The above copyright notice and this permission notice shall be included  *
1406bfebdeSXin LI * in all copies or substantial portions of the Software.                   *
1506bfebdeSXin LI *                                                                          *
1606bfebdeSXin LI * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
1706bfebdeSXin LI * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
1806bfebdeSXin LI * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
1906bfebdeSXin LI * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
2006bfebdeSXin LI * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
2106bfebdeSXin LI * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
2206bfebdeSXin LI * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
2306bfebdeSXin LI *                                                                          *
2406bfebdeSXin LI * Except as contained in this notice, the name(s) of the above copyright   *
2506bfebdeSXin LI * holders shall not be used in advertising or otherwise to promote the     *
2606bfebdeSXin LI * sale, use or other dealings in this Software without prior written       *
2706bfebdeSXin LI * authorization.                                                           *
2806bfebdeSXin LI ****************************************************************************/
29*21817992SBaptiste Daroussin/* $Id: ncurses_dll.h.in,v 1.18 2023/05/06 20:12:43 tom Exp $ */
3006bfebdeSXin LI
3106bfebdeSXin LI#ifndef NCURSES_DLL_H_incl
3206bfebdeSXin LI#define NCURSES_DLL_H_incl 1
3306bfebdeSXin LI
3406bfebdeSXin LI/*
35aae38d10SBaptiste Daroussin * MinGW gcc (unlike MSYS2 and Cygwin) should define _WIN32 and possibly _WIN64.
36aae38d10SBaptiste Daroussin */
37aae38d10SBaptiste Daroussin#if defined(__MINGW64__)
38aae38d10SBaptiste Daroussin
39aae38d10SBaptiste Daroussin#ifndef _WIN64
40aae38d10SBaptiste Daroussin#define _WIN64 1
41aae38d10SBaptiste Daroussin#endif
42aae38d10SBaptiste Daroussin
43aae38d10SBaptiste Daroussin#elif defined(__MINGW32__)
44aae38d10SBaptiste Daroussin
45aae38d10SBaptiste Daroussin#ifndef _WIN32
46aae38d10SBaptiste Daroussin#define _WIN32 1
47aae38d10SBaptiste Daroussin#endif
48aae38d10SBaptiste Daroussin
49aae38d10SBaptiste Daroussin/* 2014-08-02 workaround for broken MinGW compiler.
50aae38d10SBaptiste Daroussin * Oddly, only TRACE is mapped to trace - the other -D's are okay.
51aae38d10SBaptiste Daroussin * suggest TDM as an alternative.
52aae38d10SBaptiste Daroussin */
53aae38d10SBaptiste Daroussin#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
54aae38d10SBaptiste Daroussin
55aae38d10SBaptiste Daroussin#ifdef trace
56aae38d10SBaptiste Daroussin#undef trace
57aae38d10SBaptiste Daroussin#define TRACE
58aae38d10SBaptiste Daroussin#endif
59aae38d10SBaptiste Daroussin
60aae38d10SBaptiste Daroussin#endif	/* broken compiler */
61aae38d10SBaptiste Daroussin
62aae38d10SBaptiste Daroussin#endif	/* MingW */
63aae38d10SBaptiste Daroussin
64aae38d10SBaptiste Daroussin/*
6506bfebdeSXin LI * For reentrant code, we map the various global variables into SCREEN by
6606bfebdeSXin LI * using functions to access them.
6706bfebdeSXin LI */
6806bfebdeSXin LI#define NCURSES_PUBLIC_VAR(name) @NCURSES_WRAP_PREFIX@##name
6906bfebdeSXin LI
707a656419SBaptiste Daroussin#if defined(BUILDING_NCURSES)
717a656419SBaptiste Daroussin# define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
7206bfebdeSXin LI#else
737a656419SBaptiste Daroussin# define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
747a656419SBaptiste Daroussin#endif
757a656419SBaptiste Daroussin
767a656419SBaptiste Daroussin#define NCURSES_WRAPPED_VAR(type,name) extern NCURSES_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
777a656419SBaptiste Daroussin
787a656419SBaptiste Daroussin#define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
797a656419SBaptiste Daroussin#define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
807a656419SBaptiste Daroussin
817a656419SBaptiste Daroussin/*
827a656419SBaptiste Daroussin * These symbols hide dllimport/dllexport, for compilers which care about it.
837a656419SBaptiste Daroussin */
847a656419SBaptiste Daroussin#if defined(__CYGWIN__) || (defined(_WIN32) || defined(_WIN64))
857a656419SBaptiste Daroussin# if defined(NCURSES_STATIC)	/* "static" here only implies "not-a-DLL" */
867a656419SBaptiste Daroussin#   define NCURSES_EXPORT_GENERAL_IMPORT
877a656419SBaptiste Daroussin#   define NCURSES_EXPORT_GENERAL_EXPORT
887a656419SBaptiste Daroussin# else
897a656419SBaptiste Daroussin#   define NCURSES_EXPORT_GENERAL_IMPORT __declspec(dllimport)
907a656419SBaptiste Daroussin#   define NCURSES_EXPORT_GENERAL_EXPORT __declspec(dllexport)
9106bfebdeSXin LI# endif
9206bfebdeSXin LI# define NCURSES_API __cdecl
937a656419SBaptiste Daroussin#else
947a656419SBaptiste Daroussin# define NCURSES_EXPORT_GENERAL_IMPORT
95*21817992SBaptiste Daroussin# if (__GNUC__ >= 4) && !defined(__cplusplus)
96*21817992SBaptiste Daroussin#   define NCURSES_EXPORT_GENERAL_EXPORT __attribute__((visibility ("default")))
97*21817992SBaptiste Daroussin# else
987a656419SBaptiste Daroussin#   define NCURSES_EXPORT_GENERAL_EXPORT
99*21817992SBaptiste Daroussin# endif
1007a656419SBaptiste Daroussin# define NCURSES_API /* FIXME: __attribute__ ((cdecl)) is only available on x86 */
10106bfebdeSXin LI#endif
10206bfebdeSXin LI
10306bfebdeSXin LI#endif /* NCURSES_DLL_H_incl */
104