Upstreamed in 04d942c3d98cf0a929c6afb17be8c10d4ae39af0

ncurses 6.2 - patch 20200704

d61c3c6a ("ncurses 6.2 - patch 20200711", 2020-07-12)

--- ncurses/win32con/wcwidth.c
+++ ncurses/win32con/wcwidth.c
@@ -36,10 +36,10 @@ MODULE_ID("$Id: wcwidth.c,v 1.3 2020/02/02 23:34:34 tom Exp $")
 #define mk_wcwidth_cjk(ucs)      _nc_wcwidth_cjk(ucs)
 #define mk_wcswidth_cjk(pwcs, n) _nc_wcswidth_cjk(pwcs, n)
 
-extern int mk_wcwidth(wchar_t);
-extern int mk_wcswidth(const wchar_t *, size_t);
-extern int mk_wcwidth_cjk(wchar_t);
-extern int mk_wcswidth_cjk(const wchar_t *, size_t);
+NCURSES_EXPORT(int) mk_wcwidth(wchar_t);
+NCURSES_EXPORT(int) mk_wcswidth(const wchar_t *, size_t);
+NCURSES_EXPORT(int) mk_wcwidth_cjk(wchar_t);
+NCURSES_EXPORT(int) mk_wcswidth_cjk(const wchar_t *, size_t);
 
 #include <wcwidth.h>
 #else
--- ncurses/wcwidth.h
+++ ncurses/wcwidth.h
@@ -119,7 +119,7 @@
  * in ISO 10646.
  */
 
-int mk_wcwidth(wchar_t ucs)
+NCURSES_EXPORT(int) mk_wcwidth(wchar_t ucs)
 {
   /* sorted list of non-overlapping intervals of non-spacing characters */
   /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */
@@ -207,7 +207,7 @@ int mk_wcwidth(wchar_t ucs)
 }
 

-int mk_wcswidth(const wchar_t *pwcs, size_t n)
+NCURSES_EXPORT(int) mk_wcswidth(const wchar_t *pwcs, size_t n)
 {
   int w, width = 0;
 
@@ -230,7 +230,7 @@ int mk_wcswidth(const wchar_t *pwcs, size_t n)
  * the traditional terminal character-width behaviour. It is not
  * otherwise recommended for general use.
  */
-int mk_wcwidth_cjk(wchar_t ucs)
+NCURSES_EXPORT(int) mk_wcwidth_cjk(wchar_t ucs)
 {
   /* sorted list of non-overlapping intervals of East Asian Ambiguous
    * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */
@@ -298,7 +298,7 @@ int mk_wcwidth_cjk(wchar_t ucs)
 }
 
 
-int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
+NCURSES_EXPORT(int) mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
 {
   int w, width = 0;
 
diff --git a/c++/cursesapp.h b/c++/cursesapp.h
index a09a3b63..e423089c 100644
--- a/c++/cursesapp.h
+++ b/c++/cursesapp.h
@@ -39,7 +39,7 @@
 
 #include <cursslk.h>
 
-class NCURSES_IMPEXP NCursesApplication {
+class NCURSES_CXX_IMPEXP NCursesApplication {
 public:
   typedef struct _slk_link {          // This structure is used to maintain
     struct _slk_link* prev;           // a stack of SLKs
diff --git a/c++/cursesf.h b/c++/cursesf.h
index 17d4c70e..1e90c360 100644
--- a/c++/cursesf.h
+++ b/c++/cursesf.h
@@ -51,11 +51,11 @@ extern "C" {
 // The abstract base class for builtin and user defined Fieldtypes.
 // -------------------------------------------------------------------------
 //
-class NCURSES_IMPEXP NCursesFormField; // forward declaration
+class NCURSES_CXX_IMPEXP NCursesFormField; // forward declaration
 
 // Class to represent builtin field types as well as C++ written new
 // fieldtypes (see classes UserDefineFieldType...
-class NCURSES_IMPEXP NCursesFieldType
+class NCURSES_CXX_IMPEXP NCursesFieldType
 {
   friend class NCursesFormField;
 
@@ -101,7 +101,7 @@ public:
 // The class representing a forms field, wrapping the lowlevel FIELD struct
 // -------------------------------------------------------------------------
 //
-class NCURSES_IMPEXP NCursesFormField
+class NCURSES_CXX_IMPEXP NCursesFormField
 {
   friend class NCursesForm;
 
@@ -338,7 +338,7 @@ extern "C" {
 // The class representing a form, wrapping the lowlevel FORM struct
 // -------------------------------------------------------------------------
 //
-class NCURSES_IMPEXP NCursesForm : public NCursesPanel
+class NCURSES_CXX_IMPEXP NCursesForm : public NCursesPanel
 {
 protected:
   FORM* form;  // the lowlevel structure
@@ -629,7 +629,7 @@ public:
 // data belongs to some class T. Use T as template argument
 // to create a UserField.
 // -------------------------------------------------------------------------
-template<class T> class NCURSES_IMPEXP NCursesUserField : public NCursesFormField
+template<class T> class NCURSES_CXX_IMPEXP NCursesUserField : public NCursesFormField
 {
 public:
   NCursesUserField (int rows,
@@ -662,7 +662,7 @@ public:
 // The same mechanism is used to attach user data to a form
 // -------------------------------------------------------------------------
 //
-template<class T> class NCURSES_IMPEXP NCursesUserForm : public NCursesForm
+template<class T> class NCURSES_CXX_IMPEXP NCursesUserForm : public NCursesForm
 {
 protected:
   // 'Internal' constructor, builds an object without association to a
@@ -721,7 +721,7 @@ public:
 // Builtin Fieldtypes
 // -------------------------------------------------------------------------
 //
-class NCURSES_IMPEXP Alpha_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Alpha_Field : public NCursesFieldType
 {
 private:
   int min_field_width;
@@ -737,7 +737,7 @@ public:
   }
 };
 
-class NCURSES_IMPEXP Alphanumeric_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Alphanumeric_Field : public NCursesFieldType
 {
 private:
   int min_field_width;
@@ -753,7 +753,7 @@ public:
   }
 };
 
-class NCURSES_IMPEXP Integer_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Integer_Field : public NCursesFieldType
 {
 private:
   int precision;
@@ -771,7 +771,7 @@ public:
   }
 };
 
-class NCURSES_IMPEXP Numeric_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Numeric_Field : public NCursesFieldType
 {
 private:
   int precision;
@@ -789,7 +789,7 @@ public:
   }
 };
 
-class NCURSES_IMPEXP Regular_Expression_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Regular_Expression_Field : public NCursesFieldType
 {
 private:
   char* regex;
@@ -834,7 +834,7 @@ public:
   }
 };
 
-class NCURSES_IMPEXP Enumeration_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Enumeration_Field : public NCursesFieldType
 {
 private:
   const char** list;
@@ -873,7 +873,7 @@ public:
   }
 };
 
-class NCURSES_IMPEXP IPV4_Address_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP IPV4_Address_Field : public NCursesFieldType
 {
 private:
   void set(NCursesFormField& f) {
@@ -896,7 +896,7 @@ extern "C" {
 // Abstract base class for User-Defined Fieldtypes
 // -------------------------------------------------------------------------
 //
-class NCURSES_IMPEXP UserDefinedFieldType : public NCursesFieldType
+class NCURSES_CXX_IMPEXP UserDefinedFieldType : public NCursesFieldType
 {
   friend class UDF_Init; // Internal helper to set up statics
 private:
@@ -939,7 +939,7 @@ extern "C" {
 // Abstract base class for User-Defined Fieldtypes with Choice functions
 // -------------------------------------------------------------------------
 //
-class NCURSES_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType
+class NCURSES_CXX_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType
 {
   friend class UDF_Init; // Internal helper to set up statics
 private:
diff --git a/c++/cursesm.h b/c++/cursesm.h
index 413da764..0eab3861 100644
--- a/c++/cursesm.h
+++ b/c++/cursesm.h
@@ -47,7 +47,7 @@ extern "C" {
 // This wraps the ITEM type of <menu.h>
 // -------------------------------------------------------------------------
 //
-class NCURSES_IMPEXP NCursesMenuItem
+class NCURSES_CXX_IMPEXP NCursesMenuItem
 {
   friend class NCursesMenu;
 
@@ -153,7 +153,7 @@ typedef bool ITEMCALLBACK(NCursesMenuItem&);
 // If you don't like to create a child class for individual items to
 // overload action(), you may use this class and provide a callback
 // function pointer for items.
-class NCURSES_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem
+class NCURSES_CXX_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem
 {
 private:
   ITEMCALLBACK* p_fct;
@@ -200,7 +200,7 @@ extern "C" {
 // This wraps the MENU type of <menu.h>
 // -------------------------------------------------------------------------
 //
-class NCURSES_IMPEXP NCursesMenu : public NCursesPanel
+class NCURSES_CXX_IMPEXP NCursesMenu : public NCursesPanel
 {
 protected:
   MENU *menu;
@@ -596,7 +596,7 @@ public:
 // to create a UserItem.
 // -------------------------------------------------------------------------
 //
-template<class T> class NCURSES_IMPEXP NCursesUserItem : public NCursesMenuItem
+template<class T> class NCURSES_CXX_IMPEXP NCursesUserItem : public NCursesMenuItem
 {
 public:
   NCursesUserItem (const char* p_name,
@@ -623,7 +623,7 @@ public:
 // The same mechanism is used to attach user data to a menu
 // -------------------------------------------------------------------------
 //
-template<class T> class NCURSES_IMPEXP NCursesUserMenu : public NCursesMenu
+template<class T> class NCURSES_CXX_IMPEXP NCursesUserMenu : public NCursesMenu
 {
 protected:
   NCursesUserMenu( int  nlines,
diff --git a/c++/cursesp.h b/c++/cursesp.h
index d1eea968..af97b022 100644
--- a/c++/cursesmain.cc
+++ b/c++/cursesmain.cc
@@ -60,7 +60,7 @@ MODULE_ID("$Id: cursesmain.cc,v 1.18 2020/04/04 23:25:34 tom Exp $")
  * You only have to instantiate a static NCursesApplication object in your
  * main application source file and link this module with your application.
  */
-int main(int argc, char* argv[])
+NCURSES_CXX_IMPEXP int main(int argc, char* argv[])
 {
   setlocale(LC_ALL, "");
 
--- a/c++/cursesp.h
+++ b/c++/cursesp.h
@@ -43,7 +43,7 @@ extern "C" {
 #  include <panel.h>
 }
 
-class NCURSES_IMPEXP NCursesPanel
+class NCURSES_CXX_IMPEXP NCursesPanel
   : public NCursesWindow
 {
 protected:
diff --git a/c++/cursesw.h b/c++/cursesw.h
index 10a2da7e..62721495 100644
--- a/c++/cursesw.h
+++ b/c++/cursesw.h
@@ -38,6 +38,19 @@ extern "C" {
 #  include   <curses.h>
 }
 
+#include "ncurses_exports.h"
+
+#if defined(BUILDING_NCURSES_CXX)
+# define NCURSES_CXX_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
+#else
+# define NCURSES_CXX_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
+#endif
+
+#define NCURSES_CXX_WRAPPED_VAR(type,name) extern NCURSES_CXX_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
+
+#define NCURSES_CXX_EXPORT(type) NCURSES_CXX_IMPEXP type NCURSES_API
+#define NCURSES_CXX_EXPORT_VAR(type) NCURSES_CXX_IMPEXP type
+
 #include <etip.h>
 
 /* SCO 3.2v4 curses.h includes term.h, which defines lines as a macro.
@@ -757,7 +770,7 @@ extern "C" int     _nc_ripoffline(int, int (*init)(WINDOW*, int));
 extern "C" int     _nc_xx_ripoff_init(WINDOW *, int);
 extern "C" int     _nc_has_mouse(void);
 
-class NCURSES_IMPEXP NCursesWindow
+class NCURSES_CXX_IMPEXP NCursesWindow
 {
   friend class NCursesMenu;
   friend class NCursesForm;
@@ -1371,7 +1384,7 @@ public:
 // -------------------------------------------------------------------------
 // We leave this here for compatibility reasons.
 // -------------------------------------------------------------------------
-class NCURSES_IMPEXP NCursesColorWindow : public NCursesWindow
+class NCURSES_CXX_IMPEXP NCursesColorWindow : public NCursesWindow
 {
 public:
   NCursesColorWindow(WINDOW* &window)   // useful only for stdscr
@@ -1417,7 +1430,7 @@ public:
 // Pad Support. We allow an association of a pad with a "real" window
 // through which the pad may be viewed.
 // -------------------------------------------------------------------------
-class NCURSES_IMPEXP NCursesPad : public NCursesWindow
+class NCURSES_CXX_IMPEXP NCursesPad : public NCursesWindow
 {
 private:
   NCursesWindow* viewWin;       // the "viewport" window
@@ -1533,7 +1546,7 @@ public:
 // A FramedPad is constructed always with a viewport window. This viewport
 // will be framed (by a box() command) and the interior of the box is the
 // viewport subwindow. On the frame we display scrollbar sliders.
-class NCURSES_IMPEXP NCursesFramedPad : public NCursesPad
+class NCURSES_CXX_IMPEXP NCursesFramedPad : public NCursesPad
 {
 protected:
   virtual void OnOperation(int pad_req);
diff --git a/c++/cursslk.h b/c++/cursslk.h
index 10364c1d..d69f27d5 100644
--- a/c++/cursslk.h
+++ b/c++/cursslk.h
@@ -39,10 +39,10 @@
 
 #include <cursesw.h>
 
-class NCURSES_IMPEXP Soft_Label_Key_Set {
+class NCURSES_CXX_IMPEXP Soft_Label_Key_Set {
 public:
   // This inner class represents the attributes of a Soft Label Key (SLK)
-  class NCURSES_IMPEXP Soft_Label_Key {
+  class NCURSES_CXX_IMPEXP Soft_Label_Key {
     friend class Soft_Label_Key_Set;
   public:
     typedef enum { Left=0, Center=1, Right=2 } Justification;
diff --git a/c++/demo.cc b/c++/demo.cc
index 2b5451a4..b5480808 100644
--- a/c++/demo.cc
+++ b/c++/demo.cc
@@ -187,7 +187,7 @@ public:
 };
 
 template class MyAction<UserData>;
-template class NCURSES_IMPEXP NCursesUserItem<UserData>;
+template class NCURSES_CXX_IMPEXP NCursesUserItem<UserData>;
 
 class QuitItem : public NCursesMenuItem
 {
diff --git a/c++/etip.h.in b/c++/etip.h.in
index 1155c5fd..65a5b450 100644
--- a/c++/etip.h.in
+++ b/c++/etip.h.in
@@ -140,11 +140,11 @@ extern "C" {
 #endif
 
 // Forward Declarations
-class NCURSES_IMPEXP NCursesPanel;
-class NCURSES_IMPEXP NCursesMenu;
-class NCURSES_IMPEXP NCursesForm;
+class NCURSES_CXX_IMPEXP NCursesPanel;
+class NCURSES_CXX_IMPEXP NCursesMenu;
+class NCURSES_CXX_IMPEXP NCursesForm;
 
-class NCURSES_IMPEXP NCursesException
+class NCURSES_CXX_IMPEXP NCursesException
 {
 public:
   const char *message;
@@ -178,7 +178,7 @@ public:
   }
 };
 
-class NCURSES_IMPEXP NCursesPanelException : public NCursesException
+class NCURSES_CXX_IMPEXP NCursesPanelException : public NCursesException
 {
 public:
   const NCursesPanel* p;
@@ -229,7 +229,7 @@ public:
   }
 };
 
-class NCURSES_IMPEXP NCursesMenuException : public NCursesException
+class NCURSES_CXX_IMPEXP NCursesMenuException : public NCursesException
 {
 public:
   const NCursesMenu* m;
@@ -280,7 +280,7 @@ public:
   }
 };
 
-class NCURSES_IMPEXP NCursesFormException : public NCursesException
+class NCURSES_CXX_IMPEXP NCursesFormException : public NCursesException
 {
 public:
   const NCursesForm* f;
diff --git a/form/f_trace.c b/form/f_trace.c
index d24708ce..6efc5225 100644
--- a/form/f_trace.c
+++ b/form/f_trace.c
@@ -35,35 +35,35 @@
 
 MODULE_ID("$Id: f_trace.c,v 1.5 2020/02/02 23:34:34 tom Exp $")
 
-NCURSES_EXPORT(FIELD **)
+FORM_EXPORT(FIELD **)
 _nc_retrace_field_ptr(FIELD **code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(FIELD *)
+FORM_EXPORT(FIELD *)
 _nc_retrace_field(FIELD *code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_retrace_field_type(FIELDTYPE *code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(FORM *)
+FORM_EXPORT(FORM *)
 _nc_retrace_form(FORM *code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(Form_Hook)
+FORM_EXPORT(Form_Hook)
 _nc_retrace_form_hook(Form_Hook code)
 {
   TR_FUNC_BFR(1);
diff --git a/form/fld_arg.c b/form/fld_arg.c
index e7555f65..852cd6a8 100644
--- a/form/fld_arg.c
+++ b/form/fld_arg.c
@@ -61,7 +61,7 @@ MODULE_ID("$Id: fld_arg.c,v 1.16 2020/02/02 23:34:34 tom Exp $")
 |   Return Values :  E_OK           - success
 |                    E_BAD_ARGUMENT - invalid argument
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_fieldtype_arg(FIELDTYPE *typ,
 		  void *(*const make_arg)(va_list *),
 		  void *(*const copy_arg)(const void *),
@@ -94,7 +94,7 @@ set_fieldtype_arg(FIELDTYPE *typ,
 |
 |   Return Values :  Pointer to structure or NULL if none is defined.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void *)
+FORM_EXPORT(void *)
 field_arg(const FIELD *field)
 {
   T((T_CALLED("field_arg(%p)"), (const void *)field));
diff --git a/form/fld_attr.c b/form/fld_attr.c
index 50e2c73d..c974f72d 100644
--- a/form/fld_attr.c
+++ b/form/fld_attr.c
@@ -40,7 +40,7 @@ MODULE_ID("$Id: fld_attr.c,v 1.13 2020/02/02 23:34:34 tom Exp $")
   --------------------------------------------------------------------------*/
 /* "Template" macro to generate a function to set a fields attribute */
 #define GEN_FIELD_ATTR_SET_FCT( name ) \
-NCURSES_IMPEXP int NCURSES_API set_field_ ## name (FIELD * field, chtype attr)\
+FORM_IMPEXP int NCURSES_API set_field_ ## name (FIELD * field, chtype attr)\
 {\
    int res = E_BAD_ARGUMENT;\
    T((T_CALLED("set_field_" #name "(%p,%s)"), (void *)field, _traceattr(attr)));\
@@ -65,7 +65,7 @@ NCURSES_IMPEXP int NCURSES_API set_field_ ## name (FIELD * field, chtype attr)\
 
 /* "Template" macro to generate a function to get a fields attribute */
 #define GEN_FIELD_ATTR_GET_FCT( name ) \
-NCURSES_IMPEXP chtype NCURSES_API field_ ## name (const FIELD * field)\
+FORM_IMPEXP chtype NCURSES_API field_ ## name (const FIELD * field)\
 {\
    T((T_CALLED("field_" #name "(%p)"), (const void *) field));\
    returnAttr( A_ATTRIBUTES & (Normalize_Field( field ) -> name) );\
diff --git a/form/fld_current.c b/form/fld_current.c
index 75e68edd..14e80e34 100644
--- a/form/fld_current.c
+++ b/form/fld_current.c
@@ -48,7 +48,7 @@ MODULE_ID("$Id: fld_current.c,v 1.15 2020/02/02 23:34:34 tom Exp $")
 |                    E_INVALID_FIELD   - current field can't be left
 |                    E_SYSTEM_ERROR    - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_current_field(FORM *form, FIELD *field)
 {
   int err = E_OK;
@@ -113,7 +113,7 @@ set_current_field(FORM *form, FIELD *field)
 |                    E_BAD_ARGUMENT    - invalid form pointer
 |                    E_REQUEST_DENIED  - there is no current field to unfocus
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 unfocus_current_field(FORM *const form)
 {
   T((T_CALLED("unfocus_current_field(%p)"), (const void *)form));
@@ -137,7 +137,7 @@ unfocus_current_field(FORM *const form)
 |
 |   Return Values :  Pointer to the current field.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD *)
+FORM_EXPORT(FIELD *)
 current_field(const FORM *form)
 {
   T((T_CALLED("current_field(%p)"), (const void *)form));
@@ -154,7 +154,7 @@ current_field(const FORM *form)
 |   Return Values :  >= 0   : field index
 |                    -1     : fieldpointer invalid or field not connected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 field_index(const FIELD *field)
 {
   T((T_CALLED("field_index(%p)"), (const void *)field));
diff --git a/form/fld_def.c b/form/fld_def.c
index e529b3c0..a9d2abf7 100644
--- a/form/fld_def.c
+++ b/form/fld_def.c
@@ -66,7 +66,7 @@ static FIELD default_field =
   NCURSES_FIELD_EXTENSION
 };
 
-NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field;
+FORM_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field;
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
@@ -82,7 +82,7 @@ NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field;
 |   Return Values :  Pointer to argument structure. Maybe NULL.
 |                    In case of an error in *err an error counter is increased.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(TypeArgument *)
+FORM_EXPORT(TypeArgument *)
 _nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err)
 {
   TypeArgument *res = (TypeArgument *)0;
@@ -130,7 +130,7 @@ _nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err)
 |   Return Values :  Pointer to argument structure. Maybe NULL.
 |                    In case of an error in *err an error counter is increased.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(TypeArgument *)
+FORM_EXPORT(TypeArgument *)
 _nc_Copy_Argument(const FIELDTYPE *typ, const TypeArgument *argp, int *err)
 {
   TypeArgument *res = (TypeArgument *)0;
@@ -179,7 +179,7 @@ _nc_Copy_Argument(const FIELDTYPE *typ, const TypeArgument *argp, int *err)
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+FORM_EXPORT(void)
 _nc_Free_Argument(const FIELDTYPE *typ, TypeArgument *argp)
 {
   if (typ != 0 && (typ->status & _HAS_ARGS) != 0)
@@ -212,7 +212,7 @@ _nc_Free_Argument(const FIELDTYPE *typ, TypeArgument *argp)
 |   Return Values :  TRUE       - copy worked
 |                    FALSE      - error occurred
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+FORM_EXPORT(bool)
 _nc_Copy_Type(FIELD *dst, FIELD const *src)
 {
   int err = 0;
@@ -247,7 +247,7 @@ _nc_Copy_Type(FIELD *dst, FIELD const *src)
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+FORM_EXPORT(void)
 _nc_Free_Type(FIELD *field)
 {
   assert(field != 0);
@@ -274,7 +274,7 @@ _nc_Free_Type(FIELD *field)
 |
 |   Return Values :  Pointer to the new field or NULL if failure.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD *)
+FORM_EXPORT(FIELD *)
 new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf)
 {
   static const FIELD_CELL blank = BLANK;
@@ -354,7 +354,7 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf)
 |                    E_BAD_ARGUMENT - invalid field pointer
 |                    E_CONNECTED    - field is connected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 free_field(FIELD *field)
 {
   T((T_CALLED("free_field(%p)"), (void *)field));
diff --git a/form/fld_dup.c b/form/fld_dup.c
index 9859a09f..08356b13 100644
--- a/form/fld_dup.c
+++ b/form/fld_dup.c
@@ -48,7 +48,7 @@ MODULE_ID("$Id: fld_dup.c,v 1.15 2020/02/02 23:34:34 tom Exp $")
 |
 |   Return Values :  Pointer to the new field or NULL if failure
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD *)
+FORM_EXPORT(FIELD *)
 dup_field(FIELD *field, int frow, int fcol)
 {
   FIELD *New_Field = (FIELD *)0;
diff --git a/form/fld_ftchoice.c b/form/fld_ftchoice.c
index 5dc5f4a9..4119e76e 100644
--- a/form/fld_ftchoice.c
+++ b/form/fld_ftchoice.c
@@ -47,7 +47,7 @@ MODULE_ID("$Id: fld_ftchoice.c,v 1.16 2020/02/02 23:34:34 tom Exp $")
 |   Return Values :  E_OK           - success
 |                    E_BAD_ARGUMENT - invalid arguments
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_fieldtype_choice(FIELDTYPE *typ,
 		     bool (*const next_choice) (FIELD *, const void *),
 		     bool (*const prev_choice) (FIELD *, const void *))
diff --git a/form/fld_ftlink.c b/form/fld_ftlink.c
index afa488b3..23bf0912 100644
--- a/form/fld_ftlink.c
+++ b/form/fld_ftlink.c
@@ -49,7 +49,7 @@ MODULE_ID("$Id: fld_ftlink.c,v 1.16 2020/02/02 23:34:34 tom Exp $")
 |
 |   Return Values :  Fieldtype pointer or NULL if error occurred.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 link_fieldtype(FIELDTYPE *type1, FIELDTYPE *type2)
 {
   FIELDTYPE *nftyp = (FIELDTYPE *)0;
diff --git a/form/fld_info.c b/form/fld_info.c
index 9963b5b3..34defdea 100644
--- a/form/fld_info.c
+++ b/form/fld_info.c
@@ -47,7 +47,7 @@ MODULE_ID("$Id: fld_info.c,v 1.12 2020/02/02 23:34:34 tom Exp $")
 |   Return Values :  E_OK           - success
 |                    E_BAD_ARGUMENT - invalid field pointer
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 field_info(const FIELD *field,
 	   int *rows, int *cols,
 	   int *frow, int *fcol,
@@ -89,7 +89,7 @@ field_info(const FIELD *field,
 |   Return Values :  E_OK           - success
 |                    E_BAD_ARGUMENT - invalid argument
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 dynamic_field_info(const FIELD *field, int *drows, int *dcols, int *maxgrow)
 {
   T((T_CALLED("dynamic_field_info(%p,%p,%p,%p)"),
diff --git a/form/fld_just.c b/form/fld_just.c
index 8097019d..f15cdcaa 100644
--- a/form/fld_just.c
+++ b/form/fld_just.c
@@ -45,7 +45,7 @@ MODULE_ID("$Id: fld_just.c,v 1.14 2020/02/02 23:34:34 tom Exp $")
 |                    E_BAD_ARGUMENT  - one of the arguments was incorrect
 |                    E_SYSTEM_ERROR  - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_field_just(FIELD *field, int just)
 {
   int res = E_BAD_ARGUMENT;
@@ -77,7 +77,7 @@ set_field_just(FIELD *field, int just)
 |
 |   Return Values :  The justification type.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 field_just(const FIELD *field)
 {
   T((T_CALLED("field_just(%p)"), (const void *)field));
diff --git a/form/fld_link.c b/form/fld_link.c
index cb67ac07..b6f4ff75 100644
--- a/form/fld_link.c
+++ b/form/fld_link.c
@@ -49,7 +49,7 @@ MODULE_ID("$Id: fld_link.c,v 1.14 2020/02/02 23:34:34 tom Exp $")
 |
 |   Return Values :  Pointer to the new field or NULL if failure
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD *)
+FORM_EXPORT(FIELD *)
 link_field(FIELD *field, int frow, int fcol)
 {
   FIELD *New_Field = (FIELD *)0;
diff --git a/form/fld_max.c b/form/fld_max.c
index 7d0e146d..8fb873b5 100644
--- a/form/fld_max.c
+++ b/form/fld_max.c
@@ -45,7 +45,7 @@ MODULE_ID("$Id: fld_max.c,v 1.16 2020/02/02 23:34:34 tom Exp $")
 |   Return Values :  E_OK           - success
 |                    E_BAD_ARGUMENT - invalid argument
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_max_field(FIELD *field, int maxgrow)
 {
   T((T_CALLED("set_max_field(%p,%d)"), (void *)field, maxgrow));
diff --git a/form/fld_move.c b/form/fld_move.c
index 0d6692f3..245f26c1 100644
--- a/form/fld_move.c
+++ b/form/fld_move.c
@@ -46,7 +46,7 @@ MODULE_ID("$Id: fld_move.c,v 1.12 2020/02/02 23:34:34 tom Exp $")
 |                    E_BAD_ARGUMENT  - invalid argument passed
 |                    E_CONNECTED     - field is connected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 move_field(FIELD *field, int frow, int fcol)
 {
   T((T_CALLED("move_field(%p,%d,%d)"), (void *)field, frow, fcol));
diff --git a/form/fld_newftyp.c b/form/fld_newftyp.c
index 18a7c073..53162f33 100644
--- a/form/fld_newftyp.c
+++ b/form/fld_newftyp.c
@@ -53,7 +53,7 @@ static FIELDTYPE default_fieldtype =
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE *)
+FORM_EXPORT_VAR(FIELDTYPE *)
   _nc_Default_FieldType = &default_fieldtype;
 
 /*---------------------------------------------------------------------------
@@ -71,7 +71,7 @@ NCURSES_EXPORT_VAR(FIELDTYPE *)
 |
 |   Return Values :  Fieldtype pointer or NULL if error occurred
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 new_fieldtype(bool (*const field_check) (FIELD *, const void *),
 	      bool (*const char_check) (int, const void *))
 {
@@ -121,7 +121,7 @@ new_fieldtype(bool (*const field_check) (FIELD *, const void *),
 |                    E_CONNECTED     - there are fields referencing the type
 |                    E_BAD_ARGUMENT  - invalid fieldtype pointer
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 free_fieldtype(FIELDTYPE *typ)
 {
   T((T_CALLED("free_fieldtype(%p)"), (void *)typ));
diff --git a/form/fld_opts.c b/form/fld_opts.c
index fee5804a..17ab8027 100644
--- a/form/fld_opts.c
+++ b/form/fld_opts.c
@@ -51,7 +51,7 @@ MODULE_ID("$Id: fld_opts.c,v 1.13 2020/02/02 23:34:34 tom Exp $")
 |                    E_BAD_ARGUMENT  - invalid options
 |                    E_SYSTEM_ERROR  - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_field_opts(FIELD *field, Field_Options opts)
 {
   int res = E_BAD_ARGUMENT;
@@ -72,7 +72,7 @@ set_field_opts(FIELD *field, Field_Options opts)
 |
 |   Return Values :  The options.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(Field_Options)
+FORM_EXPORT(Field_Options)
 field_opts(const FIELD *field)
 {
   T((T_CALLED("field_opts(%p)"), (const void *)field));
@@ -92,7 +92,7 @@ field_opts(const FIELD *field)
 |                    E_BAD_ARGUMENT  - invalid options
 |                    E_SYSTEM_ERROR  - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 field_opts_on(FIELD *field, Field_Options opts)
 {
   int res = E_BAD_ARGUMENT;
@@ -120,7 +120,7 @@ field_opts_on(FIELD *field, Field_Options opts)
 |                    E_BAD_ARGUMENT  - invalid options
 |                    E_SYSTEM_ERROR  - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 field_opts_off(FIELD *field, Field_Options opts)
 {
   int res = E_BAD_ARGUMENT;
diff --git a/form/fld_pad.c b/form/fld_pad.c
index b6d59e2c..260ec407 100644
--- a/form/fld_pad.c
+++ b/form/fld_pad.c
@@ -46,7 +46,7 @@ MODULE_ID("$Id: fld_pad.c,v 1.11 2020/02/02 23:34:34 tom Exp $")
 |                    E_BAD_ARGUMENT - invalid field pointer or pad character
 |                    E_SYSTEM_ERROR - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_field_pad(FIELD *field, int ch)
 {
   int res = E_BAD_ARGUMENT;
@@ -75,7 +75,7 @@ set_field_pad(FIELD *field, int ch)
 |
 |   Return Values :  The pad character.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 field_pad(const FIELD *field)
 {
   T((T_CALLED("field_pad(%p)"), (const void *)field));
diff --git a/form/fld_page.c b/form/fld_page.c
index c6fb37c8..7310202c 100644
--- a/form/fld_page.c
+++ b/form/fld_page.c
@@ -45,7 +45,7 @@ MODULE_ID("$Id: fld_page.c,v 1.13 2020/02/02 23:34:34 tom Exp $")
 |   Return Values :  E_OK         - success
 |                    E_CONNECTED  - field is connected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_new_page(FIELD *field, bool new_page_flag)
 {
   T((T_CALLED("set_new_page(%p,%d)"), (void *)field, new_page_flag));
@@ -72,7 +72,7 @@ set_new_page(FIELD *field, bool new_page_flag)
 |   Return Values :  TRUE  - field starts a new page
 |                    FALSE - field doesn't start a new page
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+FORM_EXPORT(bool)
 new_page(const FIELD *field)
 {
   T((T_CALLED("new_page(%p)"), (const void *)field));
diff --git a/form/fld_stat.c b/form/fld_stat.c
index 487a21dc..19000af2 100644
--- a/form/fld_stat.c
+++ b/form/fld_stat.c
@@ -44,7 +44,7 @@ MODULE_ID("$Id: fld_stat.c,v 1.15 2020/02/02 23:34:34 tom Exp $")
 |
 |   Return Values :  E_OK            - success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_field_status(FIELD *field, bool status)
 {
   T((T_CALLED("set_field_status(%p,%d)"), (void *)field, status));
@@ -69,7 +69,7 @@ set_field_status(FIELD *field, bool status)
 |   Return Values :  TRUE  - buffer has been changed
 |                    FALSE - buffer has not been changed
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+FORM_EXPORT(bool)
 field_status(const FIELD *field)
 {
   T((T_CALLED("field_status(%p)"), (const void *)field));
diff --git a/form/fld_type.c b/form/fld_type.c
index a445fa4d..69ebe4ca 100644
--- a/form/fld_type.c
+++ b/form/fld_type.c
@@ -46,7 +46,7 @@ MODULE_ID("$Id: fld_type.c,v 1.17 2020/02/02 23:34:34 tom Exp $")
 |   Return Values :  E_OK           - success
 |                    E_SYSTEM_ERROR - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_field_type(FIELD *field, FIELDTYPE *type,...)
 {
   va_list ap;
@@ -88,7 +88,7 @@ set_field_type(FIELD *field, FIELDTYPE *type,...)
 |
 |   Return Values :  Pointer to fieldtype of NULL if none is defined.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 field_type(const FIELD *field)
 {
   T((T_CALLED("field_type(%p)"), (const void *)field));
diff --git a/form/fld_user.c b/form/fld_user.c
index 5cd165c8..2deb68e6 100644
--- a/form/fld_user.c
+++ b/form/fld_user.c
@@ -44,7 +44,7 @@ MODULE_ID("$Id: fld_user.c,v 1.17 2020/02/02 23:34:34 tom Exp $")
 |
 |   Return Values :  E_OK         - on success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_field_userptr(FIELD *field, void *usrptr)
 {
   T((T_CALLED("set_field_userptr(%p,%p)"), (void *)field, (void *)usrptr));
@@ -63,7 +63,7 @@ set_field_userptr(FIELD *field, void *usrptr)
 |   Return Values :  Value of pointer. If no such pointer has been set,
 |                    NULL is returned
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void *)
+FORM_EXPORT(void *)
 field_userptr(const FIELD *field)
 {
   T((T_CALLED("field_userptr(%p)"), (const void *)field));
diff --git a/form/form.h b/form/form.h
index dabe6764..3c584357 100644
--- a/form/form.h
+++ b/form/form.h
@@ -44,6 +44,19 @@
   extern "C" {
 #endif
 
+#include "ncurses_exports.h"
+
+#if defined(BUILDING_FORM)
+# define FORM_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
+#else
+# define FORM_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
+#endif
+
+#define FORM_WRAPPED_VAR(type,name) extern FORM_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
+
+#define FORM_EXPORT(type) FORM_IMPEXP type NCURSES_API
+#define FORM_EXPORT_VAR(type) FORM_IMPEXP type
+
 #ifndef FORM_PRIV_H
 typedef void *FIELD_CELL;
 #endif
@@ -309,136 +322,136 @@ typedef void (*Form_Hook)(FORM *);
 	/*************************
 	*  standard field types  *
 	*************************/
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP;
+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA;
+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM;
+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM;
+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER;
+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC;
+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP;
 
 	/************************************
 	*  built-in additional field types  *
 	*  They are not defined in SVr4     *
 	************************************/
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4;      /* Internet IP Version 4 address */
+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4;      /* Internet IP Version 4 address */
 
 	/***********************
 	*  FIELDTYPE routines  *
 	***********************/
-extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype (
+extern FORM_EXPORT(FIELDTYPE *) new_fieldtype (
 		    bool (* const field_check)(FIELD *,const void *),
 		    bool (* const char_check)(int,const void *));
-extern NCURSES_EXPORT(FIELDTYPE *) link_fieldtype(
+extern FORM_EXPORT(FIELDTYPE *) link_fieldtype(
 		    FIELDTYPE *, FIELDTYPE *);
 
-extern NCURSES_EXPORT(int)	free_fieldtype (FIELDTYPE *);
-extern NCURSES_EXPORT(int)	set_fieldtype_arg (FIELDTYPE *,
+extern FORM_EXPORT(int)	free_fieldtype (FIELDTYPE *);
+extern FORM_EXPORT(int)	set_fieldtype_arg (FIELDTYPE *,
 		    void * (* const make_arg)(va_list *),
 		    void * (* const copy_arg)(const void *),
 		    void (* const free_arg)(void *));
-extern NCURSES_EXPORT(int)	 set_fieldtype_choice (FIELDTYPE *,
+extern FORM_EXPORT(int)	 set_fieldtype_choice (FIELDTYPE *,
 		    bool (* const next_choice)(FIELD *,const void *),
 	      	    bool (* const prev_choice)(FIELD *,const void *));
 
 	/*******************
 	*  FIELD routines  *
 	*******************/
-extern NCURSES_EXPORT(FIELD *)	new_field (int,int,int,int,int,int);
-extern NCURSES_EXPORT(FIELD *)	dup_field (FIELD *,int,int);
-extern NCURSES_EXPORT(FIELD *)	link_field (FIELD *,int,int);
-
-extern NCURSES_EXPORT(int)	free_field (FIELD *);
-extern NCURSES_EXPORT(int)	field_info (const FIELD *,int *,int *,int *,int *,int *,int *);
-extern NCURSES_EXPORT(int)	dynamic_field_info (const FIELD *,int *,int *,int *);
-extern NCURSES_EXPORT(int)	set_max_field ( FIELD *,int);
-extern NCURSES_EXPORT(int)	move_field (FIELD *,int,int);
-extern NCURSES_EXPORT(int)	set_field_type (FIELD *,FIELDTYPE *,...);
-extern NCURSES_EXPORT(int)	set_new_page (FIELD *,bool);
-extern NCURSES_EXPORT(int)	set_field_just (FIELD *,int);
-extern NCURSES_EXPORT(int)	field_just (const FIELD *);
-extern NCURSES_EXPORT(int)	set_field_fore (FIELD *,chtype);
-extern NCURSES_EXPORT(int)	set_field_back (FIELD *,chtype);
-extern NCURSES_EXPORT(int)	set_field_pad (FIELD *,int);
-extern NCURSES_EXPORT(int)	field_pad (const FIELD *);
-extern NCURSES_EXPORT(int)	set_field_buffer (FIELD *,int,const char *);
-extern NCURSES_EXPORT(int)	set_field_status (FIELD *,bool);
-extern NCURSES_EXPORT(int)	set_field_userptr (FIELD *, void *);
-extern NCURSES_EXPORT(int)	set_field_opts (FIELD *,Field_Options);
-extern NCURSES_EXPORT(int)	field_opts_on (FIELD *,Field_Options);
-extern NCURSES_EXPORT(int)	field_opts_off (FIELD *,Field_Options);
-
-extern NCURSES_EXPORT(chtype)	field_fore (const FIELD *);
-extern NCURSES_EXPORT(chtype)	field_back (const FIELD *);
-
-extern NCURSES_EXPORT(bool)	new_page (const FIELD *);
-extern NCURSES_EXPORT(bool)	field_status (const FIELD *);
-
-extern NCURSES_EXPORT(void *)	field_arg (const FIELD *);
-
-extern NCURSES_EXPORT(void *)	field_userptr (const FIELD *);
-
-extern NCURSES_EXPORT(FIELDTYPE *)	field_type (const FIELD *);
-
-extern NCURSES_EXPORT(char *)	field_buffer (const FIELD *,int);
-
-extern NCURSES_EXPORT(Field_Options)	field_opts (const FIELD *);
+extern FORM_EXPORT(FIELD *)	new_field (int,int,int,int,int,int);
+extern FORM_EXPORT(FIELD *)	dup_field (FIELD *,int,int);
+extern FORM_EXPORT(FIELD *)	link_field (FIELD *,int,int);
+
+extern FORM_EXPORT(int)	free_field (FIELD *);
+extern FORM_EXPORT(int)	field_info (const FIELD *,int *,int *,int *,int *,int *,int *);
+extern FORM_EXPORT(int)	dynamic_field_info (const FIELD *,int *,int *,int *);
+extern FORM_EXPORT(int)	set_max_field ( FIELD *,int);
+extern FORM_EXPORT(int)	move_field (FIELD *,int,int);
+extern FORM_EXPORT(int)	set_field_type (FIELD *,FIELDTYPE *,...);
+extern FORM_EXPORT(int)	set_new_page (FIELD *,bool);
+extern FORM_EXPORT(int)	set_field_just (FIELD *,int);
+extern FORM_EXPORT(int)	field_just (const FIELD *);
+extern FORM_EXPORT(int)	set_field_fore (FIELD *,chtype);
+extern FORM_EXPORT(int)	set_field_back (FIELD *,chtype);
+extern FORM_EXPORT(int)	set_field_pad (FIELD *,int);
+extern FORM_EXPORT(int)	field_pad (const FIELD *);
+extern FORM_EXPORT(int)	set_field_buffer (FIELD *,int,const char *);
+extern FORM_EXPORT(int)	set_field_status (FIELD *,bool);
+extern FORM_EXPORT(int)	set_field_userptr (FIELD *, void *);
+extern FORM_EXPORT(int)	set_field_opts (FIELD *,Field_Options);
+extern FORM_EXPORT(int)	field_opts_on (FIELD *,Field_Options);
+extern FORM_EXPORT(int)	field_opts_off (FIELD *,Field_Options);
+
+extern FORM_EXPORT(chtype)	field_fore (const FIELD *);
+extern FORM_EXPORT(chtype)	field_back (const FIELD *);
+
+extern FORM_EXPORT(bool)	new_page (const FIELD *);
+extern FORM_EXPORT(bool)	field_status (const FIELD *);
+
+extern FORM_EXPORT(void *)	field_arg (const FIELD *);
+
+extern FORM_EXPORT(void *)	field_userptr (const FIELD *);
+
+extern FORM_EXPORT(FIELDTYPE *)	field_type (const FIELD *);
+
+extern FORM_EXPORT(char *)	field_buffer (const FIELD *,int);
+
+extern FORM_EXPORT(Field_Options)	field_opts (const FIELD *);
 
 	/******************
 	*  FORM routines  *
 	******************/
 
-extern NCURSES_EXPORT(FORM *)	new_form (FIELD **);
-
-extern NCURSES_EXPORT(FIELD **)	form_fields (const FORM *);
-extern NCURSES_EXPORT(FIELD *)	current_field (const FORM *);
-
-extern NCURSES_EXPORT(WINDOW *)	form_win (const FORM *);
-extern NCURSES_EXPORT(WINDOW *)	form_sub (const FORM *);
-
-extern NCURSES_EXPORT(Form_Hook)	form_init (const FORM *);
-extern NCURSES_EXPORT(Form_Hook)	form_term (const FORM *);
-extern NCURSES_EXPORT(Form_Hook)	field_init (const FORM *);
-extern NCURSES_EXPORT(Form_Hook)	field_term (const FORM *);
-
-extern NCURSES_EXPORT(int)	free_form (FORM *);
-extern NCURSES_EXPORT(int)	set_form_fields (FORM *,FIELD **);
-extern NCURSES_EXPORT(int)	field_count (const FORM *);
-extern NCURSES_EXPORT(int)	set_form_win (FORM *,WINDOW *);
-extern NCURSES_EXPORT(int)	set_form_sub (FORM *,WINDOW *);
-extern NCURSES_EXPORT(int)	set_current_field (FORM *,FIELD *);
-extern NCURSES_EXPORT(int)	unfocus_current_field (FORM *);
-extern NCURSES_EXPORT(int)	field_index (const FIELD *);
-extern NCURSES_EXPORT(int)	set_form_page (FORM *,int);
-extern NCURSES_EXPORT(int)	form_page (const FORM *);
-extern NCURSES_EXPORT(int)	scale_form (const FORM *,int *,int *);
-extern NCURSES_EXPORT(int)	set_form_init (FORM *,Form_Hook);
-extern NCURSES_EXPORT(int)	set_form_term (FORM *,Form_Hook);
-extern NCURSES_EXPORT(int)	set_field_init (FORM *,Form_Hook);
-extern NCURSES_EXPORT(int)	set_field_term (FORM *,Form_Hook);
-extern NCURSES_EXPORT(int)	post_form (FORM *);
-extern NCURSES_EXPORT(int)	unpost_form (FORM *);
-extern NCURSES_EXPORT(int)	pos_form_cursor (FORM *);
-extern NCURSES_EXPORT(int)	form_driver (FORM *,int);
+extern FORM_EXPORT(FORM *)	new_form (FIELD **);
+
+extern FORM_EXPORT(FIELD **)	form_fields (const FORM *);
+extern FORM_EXPORT(FIELD *)	current_field (const FORM *);
+
+extern FORM_EXPORT(WINDOW *)	form_win (const FORM *);
+extern FORM_EXPORT(WINDOW *)	form_sub (const FORM *);
+
+extern FORM_EXPORT(Form_Hook)	form_init (const FORM *);
+extern FORM_EXPORT(Form_Hook)	form_term (const FORM *);
+extern FORM_EXPORT(Form_Hook)	field_init (const FORM *);
+extern FORM_EXPORT(Form_Hook)	field_term (const FORM *);
+
+extern FORM_EXPORT(int)	free_form (FORM *);
+extern FORM_EXPORT(int)	set_form_fields (FORM *,FIELD **);
+extern FORM_EXPORT(int)	field_count (const FORM *);
+extern FORM_EXPORT(int)	set_form_win (FORM *,WINDOW *);
+extern FORM_EXPORT(int)	set_form_sub (FORM *,WINDOW *);
+extern FORM_EXPORT(int)	set_current_field (FORM *,FIELD *);
+extern FORM_EXPORT(int)	unfocus_current_field (FORM *);
+extern FORM_EXPORT(int)	field_index (const FIELD *);
+extern FORM_EXPORT(int)	set_form_page (FORM *,int);
+extern FORM_EXPORT(int)	form_page (const FORM *);
+extern FORM_EXPORT(int)	scale_form (const FORM *,int *,int *);
+extern FORM_EXPORT(int)	set_form_init (FORM *,Form_Hook);
+extern FORM_EXPORT(int)	set_form_term (FORM *,Form_Hook);
+extern FORM_EXPORT(int)	set_field_init (FORM *,Form_Hook);
+extern FORM_EXPORT(int)	set_field_term (FORM *,Form_Hook);
+extern FORM_EXPORT(int)	post_form (FORM *);
+extern FORM_EXPORT(int)	unpost_form (FORM *);
+extern FORM_EXPORT(int)	pos_form_cursor (FORM *);
+extern FORM_EXPORT(int)	form_driver (FORM *,int);
 # if NCURSES_WIDECHAR
-extern NCURSES_EXPORT(int)	form_driver_w (FORM *,int,wchar_t);
+extern FORM_EXPORT(int)	form_driver_w (FORM *,int,wchar_t);
 # endif
-extern NCURSES_EXPORT(int)	set_form_userptr (FORM *,void *);
-extern NCURSES_EXPORT(int)	set_form_opts (FORM *,Form_Options);
-extern NCURSES_EXPORT(int)	form_opts_on (FORM *,Form_Options);
-extern NCURSES_EXPORT(int)	form_opts_off (FORM *,Form_Options);
-extern NCURSES_EXPORT(int)	form_request_by_name (const char *);
+extern FORM_EXPORT(int)	set_form_userptr (FORM *,void *);
+extern FORM_EXPORT(int)	set_form_opts (FORM *,Form_Options);
+extern FORM_EXPORT(int)	form_opts_on (FORM *,Form_Options);
+extern FORM_EXPORT(int)	form_opts_off (FORM *,Form_Options);
+extern FORM_EXPORT(int)	form_request_by_name (const char *);
 
-extern NCURSES_EXPORT(const char *)	form_request_name (int);
+extern FORM_EXPORT(const char *)	form_request_name (int);
 
-extern NCURSES_EXPORT(void *)	form_userptr (const FORM *);
+extern FORM_EXPORT(void *)	form_userptr (const FORM *);
 
-extern NCURSES_EXPORT(Form_Options)	form_opts (const FORM *);
+extern FORM_EXPORT(Form_Options)	form_opts (const FORM *);
 
-extern NCURSES_EXPORT(bool)	data_ahead (const FORM *);
-extern NCURSES_EXPORT(bool)	data_behind (const FORM *);
+extern FORM_EXPORT(bool)	data_ahead (const FORM *);
+extern FORM_EXPORT(bool)	data_behind (const FORM *);
 
 #if NCURSES_SP_FUNCS
-extern NCURSES_EXPORT(FORM *)	NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
+extern FORM_EXPORT(FORM *)	NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
 #endif
 
 #ifdef __cplusplus
diff --git a/form/form.priv.h b/form/form.priv.h
index 53c717c6..fe60b91a 100644
--- a/form/form.priv.h
+++ b/form/form.priv.h
@@ -69,9 +69,9 @@
 	/***********************
 	*   Default objects    *
 	***********************/
-extern NCURSES_EXPORT_VAR(FORM *)      _nc_Default_Form;
-extern NCURSES_EXPORT_VAR(FIELD *)     _nc_Default_Field;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) _nc_Default_FieldType;
+extern FORM_EXPORT_VAR(FORM *)      _nc_Default_Form;
+extern FORM_EXPORT_VAR(FIELD *)     _nc_Default_Field;
+extern FORM_EXPORT_VAR(FIELDTYPE *) _nc_Default_FieldType;
 
 /* form  status values */
 #define _OVLMODE         (0x04U) /* Form is in overlay mode                */
@@ -176,32 +176,32 @@ TypeArgument;
 
 #define C_ZEROS '\0'
 
-extern NCURSES_EXPORT(TypeArgument *) _nc_Make_Argument (const FIELDTYPE*, va_list*, int*);
-extern NCURSES_EXPORT(TypeArgument *) _nc_Copy_Argument (const FIELDTYPE*, const TypeArgument*, int*);
-extern NCURSES_EXPORT(void) _nc_Free_Argument (const FIELDTYPE*, TypeArgument*);
-extern NCURSES_EXPORT(bool) _nc_Copy_Type (FIELD*, FIELD const *);
-extern NCURSES_EXPORT(void) _nc_Free_Type (FIELD *);
-
-extern NCURSES_EXPORT(int) _nc_Synchronize_Attributes (FIELD*);
-extern NCURSES_EXPORT(int) _nc_Synchronize_Options (FIELD*, Field_Options);
-extern NCURSES_EXPORT(int) _nc_Set_Form_Page (FORM*, int, FIELD*);
-extern NCURSES_EXPORT(int) _nc_Refresh_Current_Field (FORM*);
-extern NCURSES_EXPORT(FIELD *) _nc_First_Active_Field (FORM*);
-extern NCURSES_EXPORT(bool) _nc_Internal_Validation (FORM*);
-extern NCURSES_EXPORT(int) _nc_Set_Current_Field (FORM*, FIELD*);
-extern NCURSES_EXPORT(int) _nc_Position_Form_Cursor (FORM*);
-extern NCURSES_EXPORT(void) _nc_Unset_Current_Field(FORM *form);
+extern FORM_EXPORT(TypeArgument *) _nc_Make_Argument (const FIELDTYPE*, va_list*, int*);
+extern FORM_EXPORT(TypeArgument *) _nc_Copy_Argument (const FIELDTYPE*, const TypeArgument*, int*);
+extern FORM_EXPORT(void) _nc_Free_Argument (const FIELDTYPE*, TypeArgument*);
+extern FORM_EXPORT(bool) _nc_Copy_Type (FIELD*, FIELD const *);
+extern FORM_EXPORT(void) _nc_Free_Type (FIELD *);
+
+extern FORM_EXPORT(int) _nc_Synchronize_Attributes (FIELD*);
+extern FORM_EXPORT(int) _nc_Synchronize_Options (FIELD*, Field_Options);
+extern FORM_EXPORT(int) _nc_Set_Form_Page (FORM*, int, FIELD*);
+extern FORM_EXPORT(int) _nc_Refresh_Current_Field (FORM*);
+extern FORM_EXPORT(FIELD *) _nc_First_Active_Field (FORM*);
+extern FORM_EXPORT(bool) _nc_Internal_Validation (FORM*);
+extern FORM_EXPORT(int) _nc_Set_Current_Field (FORM*, FIELD*);
+extern FORM_EXPORT(int) _nc_Position_Form_Cursor (FORM*);
+extern FORM_EXPORT(void) _nc_Unset_Current_Field(FORM *form);
 
 #if NCURSES_INTEROP_FUNCS
-extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_INTEGER(void);
-extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_ALNUM(void);
-extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_ALPHA(void);
-extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_ENUM(void);
-extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_NUMERIC(void);
-extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_REGEXP(void);
-extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_IPV4(void);
-
-extern NCURSES_EXPORT(FIELDTYPE *)
+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_INTEGER(void);
+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_ALNUM(void);
+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_ALPHA(void);
+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_ENUM(void);
+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_NUMERIC(void);
+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_REGEXP(void);
+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_IPV4(void);
+
+extern FORM_EXPORT(FIELDTYPE *)
 _nc_generic_fieldtype(bool (*const field_check) (FORM*, 
 						 FIELD *, 
 						 const void *),
@@ -212,18 +212,18 @@ _nc_generic_fieldtype(bool (*const field_check) (FORM*,
 		      bool (*const next)(FORM*,FIELD*,const void*),
 		      bool (*const prev)(FORM*,FIELD*,const void*),
 		      void (*freecallback)(void*));
-extern NCURSES_EXPORT(int) _nc_set_generic_fieldtype(FIELD*, FIELDTYPE*, int (*)(void**));
-extern NCURSES_EXPORT(WINDOW*) _nc_form_cursor(const FORM* , int* , int* );
+extern FORM_EXPORT(int) _nc_set_generic_fieldtype(FIELD*, FIELDTYPE*, int (*)(void**));
+extern FORM_EXPORT(WINDOW*) _nc_form_cursor(const FORM* , int* , int* );
 
 #define INIT_FT_FUNC(func) {func}
 #else
 #define INIT_FT_FUNC(func) func
 #endif
 
-extern NCURSES_EXPORT(void) _nc_get_fieldbuffer(FORM*, FIELD*, FIELD_CELL*);
+extern FORM_EXPORT(void) _nc_get_fieldbuffer(FORM*, FIELD*, FIELD_CELL*);
 
 #if USE_WIDEC_SUPPORT
-extern NCURSES_EXPORT(wchar_t *) _nc_Widen_String(char *, int *);
+extern FORM_EXPORT(wchar_t *) _nc_Widen_String(char *, int *);
 #endif
 
 #ifdef TRACE
@@ -234,11 +234,11 @@ extern NCURSES_EXPORT(wchar_t *) _nc_Widen_String(char *, int *);
 #define returnFieldType(code)	TRACE_RETURN1(code,field_type)
 #define returnFormHook(code)	TRACE_RETURN1(code,form_hook)
 
-extern NCURSES_EXPORT(FIELD **)	    _nc_retrace_field_ptr (FIELD **);
-extern NCURSES_EXPORT(FIELD *)	    _nc_retrace_field (FIELD *);
-extern NCURSES_EXPORT(FIELDTYPE *)  _nc_retrace_field_type (FIELDTYPE *);
-extern NCURSES_EXPORT(FORM *)       _nc_retrace_form (FORM *);
-extern NCURSES_EXPORT(Form_Hook)    _nc_retrace_form_hook (Form_Hook);
+extern FORM_EXPORT(FIELD **)	    _nc_retrace_field_ptr (FIELD **);
+extern FORM_EXPORT(FIELD *)	    _nc_retrace_field (FIELD *);
+extern FORM_EXPORT(FIELDTYPE *)  _nc_retrace_field_type (FIELDTYPE *);
+extern FORM_EXPORT(FORM *)       _nc_retrace_form (FORM *);
+extern FORM_EXPORT(Form_Hook)    _nc_retrace_form_hook (Form_Hook);
 
 #else /* !TRACE */
 
diff --git a/form/frm_cursor.c b/form/frm_cursor.c
index 8ff42bf8..8ec64f73 100644
--- a/form/frm_cursor.c
+++ b/form/frm_cursor.c
@@ -49,7 +49,7 @@ MODULE_ID("$Id: frm_cursor.c,v 1.11 2020/02/02 23:34:34 tom Exp $")
 |                    E_BAD_ARGUMENT            - Invalid form pointer
 |                    E_NOT_POSTED              - Form is not posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 pos_form_cursor(FORM *form)
 {
   int res;
diff --git a/form/frm_data.c b/form/frm_data.c
index 5c3b2a04..2860fad7 100644
--- a/form/frm_data.c
+++ b/form/frm_data.c
@@ -45,7 +45,7 @@ MODULE_ID("$Id: frm_data.c,v 1.17 2020/02/02 23:34:34 tom Exp $")
 |   Return Values :  TRUE   - there are off-screen data behind
 |                    FALSE  - there are no off-screen data behind
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+FORM_EXPORT(bool)
 data_behind(const FORM *form)
 {
   bool result = FALSE;
@@ -132,7 +132,7 @@ Only_Padding(WINDOW *w, int len, int pad)
 |   Return Values :  TRUE   - there are off-screen data ahead
 |                    FALSE  - there are no off-screen data ahead
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+FORM_EXPORT(bool)
 data_ahead(const FORM *form)
 {
   bool result = FALSE;
diff --git a/form/frm_def.c b/form/frm_def.c
index 0722d517..273d0441 100644
--- a/form/frm_def.c
+++ b/form/frm_def.c
@@ -62,7 +62,7 @@ static FORM default_form =
   NULL				/* fieldterm  */
 };
 
-NCURSES_EXPORT_VAR(FORM *) _nc_Default_Form = &default_form;
+FORM_EXPORT_VAR(FORM *) _nc_Default_Form = &default_form;
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -295,7 +295,7 @@ Associate_Fields(FORM *form, FIELD **fields)
 |                    E_CONNECTED     - a field is already connected
 |                    E_SYSTEM_ERROR  - not enough memory
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FORM *)
+FORM_EXPORT(FORM *)
 NCURSES_SP_NAME(new_form) (NCURSES_SP_DCLx FIELD **fields)
 {
   int err = E_SYSTEM_ERROR;
@@ -344,7 +344,7 @@ NCURSES_SP_NAME(new_form) (NCURSES_SP_DCLx FIELD **fields)
 |                    E_SYSTEM_ERROR  - not enough memory
 +--------------------------------------------------------------------------*/
 #if NCURSES_SP_FUNCS
-NCURSES_EXPORT(FORM *)
+FORM_EXPORT(FORM *)
 new_form(FIELD **fields)
 {
   return NCURSES_SP_NAME(new_form) (CURRENT_SCREEN, fields);
@@ -361,7 +361,7 @@ new_form(FIELD **fields)
 |                    E_BAD_ARGUMENT - invalid form pointer
 |                    E_POSTED       - form is posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 free_form(FORM *form)
 {
   T((T_CALLED("free_form(%p)"), (void *)form));
@@ -392,7 +392,7 @@ free_form(FORM *form)
 |                    E_POSTED        - form is posted
 |                    E_SYSTEM_ERROR  - not enough memory
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_form_fields(FORM *form, FIELD **fields)
 {
   FIELD **old;
@@ -423,7 +423,7 @@ set_form_fields(FORM *form, FIELD **fields)
 |
 |   Return Values :  Pointer to field array
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD **)
+FORM_EXPORT(FIELD **)
 form_fields(const FORM *form)
 {
   T((T_CALLED("form_field(%p)"), (const void *)form));
@@ -438,7 +438,7 @@ form_fields(const FORM *form)
 |
 |   Return Values :  Number of fields, -1 if none are defined
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 field_count(const FORM *form)
 {
   T((T_CALLED("field_count(%p)"), (const void *)form));
diff --git a/form/frm_driver.c b/form/frm_driver.c
index b9f91e12..7b92a2ad 100644
--- a/form/frm_driver.c
+++ b/form/frm_driver.c
@@ -548,7 +548,7 @@ Buffer_To_Window(const FIELD *field, WINDOW *win)
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+FORM_EXPORT(void)
 _nc_get_fieldbuffer(FORM *form, FIELD *field, FIELD_CELL *buf)
 {
   int pad;
@@ -826,7 +826,7 @@ Field_encloses(FIELD *field, int ry, int rx)
 |                    E_SYSTEM_ERROR    - form has no current field or
 |                                        field-window
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 _nc_Position_Form_Cursor(FORM *form)
 {
   FIELD *field;
@@ -868,7 +868,7 @@ _nc_Position_Form_Cursor(FORM *form)
 |                    E_SYSTEM_ERROR    - general error
 +--------------------------------------------------------------------------*/
 static bool move_after_insert = TRUE;
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 _nc_Refresh_Current_Field(FORM *form)
 {
   WINDOW *formwin;
@@ -1271,7 +1271,7 @@ Synchronize_Linked_Fields(FIELD *field)
 |                    E_BAD_ARGUMENT   - invalid field pointer
 |                    E_SYSTEM_ERROR   - some severe basic error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 _nc_Synchronize_Attributes(FIELD *field)
 {
   FORM *form;
@@ -1338,7 +1338,7 @@ _nc_Synchronize_Attributes(FIELD *field)
 |                    E_CURRENT           - field is the current one
 |                    E_SYSTEM_ERROR      - some severe basic error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 _nc_Synchronize_Options(FIELD *field, Field_Options newopts)
 {
   Field_Options oldopts;
@@ -1491,7 +1491,7 @@ _nc_Unset_Current_Field(FORM *form)
 |                    E_SYSTEM_ERROR    - some severe basic error
 |                    E_NOT_CONNECTED   - no fields are connected to the form
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 _nc_Set_Current_Field(FORM *form, FIELD *newfield)
 {
   FIELD *field;
@@ -3225,7 +3225,7 @@ Check_Field(FORM *form, FIELDTYPE *typ, FIELD *field, TypeArgument *argp)
 |   Return Values :  TRUE  - field is valid
 |                    FALSE - field is invalid
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+FORM_EXPORT(bool)
 _nc_Internal_Validation(FORM *form)
 {
   FIELD *field;
@@ -3319,7 +3319,7 @@ Next_Field_On_Page(FIELD *field)
 |
 |   Return Values :  Pointer to calculated field.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD *)
+FORM_EXPORT(FIELD *)
 _nc_First_Active_Field(FORM *form)
 {
   FIELD **last_on_page = &form->field[form->page[form->curpage].pmax];
@@ -3873,7 +3873,7 @@ FN_Down_Field(FORM *form)
 |                    E_BAD_ARGUMENT      - invalid field pointer
 |                    E_SYSTEM_ERROR      - some severe basic error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 _nc_Set_Form_Page(FORM *form, int page, FIELD *field)
 {
   int res = E_OK;
@@ -4354,7 +4354,7 @@ static const Binding_Info bindings[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] =
 |                    E_NOT_CONNECTED   - no fields are connected to the form
 |                    E_UNKNOWN_COMMAND - command not known
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 form_driver(FORM *form, int c)
 {
   const Binding_Info *BI = (Binding_Info *) 0;
@@ -4561,7 +4561,7 @@ form_driver(FORM *form, int c)
 |                    E_NOT_CONNECTED   - no fields are connected to the form
 |                    E_UNKNOWN_COMMAND - command not known
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 form_driver_w(FORM *form, int type, wchar_t c)
 {
   const Binding_Info *BI = (Binding_Info *) 0;
@@ -4743,7 +4743,7 @@ form_driver_w(FORM *form, int type, wchar_t c)
 |                    E_BAD_ARGUMENT  - invalid argument
 |                    E_SYSTEM_ERROR  - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_field_buffer(FIELD *field, int buffer, const char *value)
 {
   FIELD_CELL *p;
@@ -4860,7 +4860,7 @@ set_field_buffer(FIELD *field, int buffer, const char *value)
 |
 |   Return Values :  Pointer to buffer or NULL if arguments were invalid.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(char *)
+FORM_EXPORT(char *)
 field_buffer(const FIELD *field, int buffer)
 {
   char *result = 0;
@@ -4928,7 +4928,7 @@ field_buffer(const FIELD *field, int buffer)
 | Convert a multibyte string to a wide-character string.  The result must be
 | freed by the caller.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(wchar_t *)
+FORM_EXPORT(wchar_t *)
 _nc_Widen_String(char *source, int *lengthp)
 {
   wchar_t *result = 0;
diff --git a/form/frm_hook.c b/form/frm_hook.c
index 3051cddc..0feb01c2 100644
--- a/form/frm_hook.c
+++ b/form/frm_hook.c
@@ -37,7 +37,7 @@ MODULE_ID("$Id: frm_hook.c,v 1.19 2020/02/02 23:34:34 tom Exp $")
 
 /* "Template" macro to generate function to set application specific hook */
 #define GEN_HOOK_SET_FUNCTION( typ, name ) \
-NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\
+FORM_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\
 {\
    TR_FUNC_BFR(1); \
    T((T_CALLED("set_" #typ"_"#name"(%p,%s)"), (void *) form, TR_FUNC_ARG(0, func)));\
@@ -47,7 +47,7 @@ NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook f
 
 /* "Template" macro to generate function to get application specific hook */
 #define GEN_HOOK_GET_FUNCTION( typ, name ) \
-NCURSES_IMPEXP Form_Hook NCURSES_API typ ## _ ## name ( const FORM *form )\
+FORM_IMPEXP Form_Hook NCURSES_API typ ## _ ## name ( const FORM *form )\
 {\
    T((T_CALLED(#typ "_" #name "(%p)"), (const void *) form));\
    returnFormHook( Normalize_Form( form ) -> typ ## name );\
diff --git a/form/frm_opts.c b/form/frm_opts.c
index 18ab2938..c6455466 100644
--- a/form/frm_opts.c
+++ b/form/frm_opts.c
@@ -45,7 +45,7 @@ MODULE_ID("$Id: frm_opts.c,v 1.18 2020/02/02 23:34:34 tom Exp $")
 |   Return Values :  E_OK              - success
 |                    E_BAD_ARGUMENT    - invalid options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_form_opts(FORM *form, Form_Options opts)
 {
   T((T_CALLED("set_form_opts(%p,%d)"), (void *)form, opts));
@@ -68,7 +68,7 @@ set_form_opts(FORM *form, Form_Options opts)
 |
 |   Return Values :  The option flags.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(Form_Options)
+FORM_EXPORT(Form_Options)
 form_opts(const FORM *form)
 {
   T((T_CALLED("form_opts(%p)"), (const void *)form));
@@ -85,7 +85,7 @@ form_opts(const FORM *form)
 |   Return Values :  E_OK            - success 
 |                    E_BAD_ARGUMENT  - invalid options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 form_opts_on(FORM *form, Form_Options opts)
 {
   T((T_CALLED("form_opts_on(%p,%d)"), (void *)form, opts));
@@ -110,7 +110,7 @@ form_opts_on(FORM *form, Form_Options opts)
 |   Return Values :  E_OK            - success 
 |                    E_BAD_ARGUMENT  - invalid options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 form_opts_off(FORM *form, Form_Options opts)
 {
   T((T_CALLED("form_opts_off(%p,%d)"), (void *)form, opts));
diff --git a/form/frm_page.c b/form/frm_page.c
index c8569eef..e07655b7 100644
--- a/form/frm_page.c
+++ b/form/frm_page.c
@@ -47,7 +47,7 @@ MODULE_ID("$Id: frm_page.c,v 1.13 2020/02/02 23:34:34 tom Exp $")
 |                    E_INVALID_FIELD   - current field can't be left
 |                    E_SYSTEM_ERROR    - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_form_page(FORM *form, int page)
 {
   int err = E_OK;
@@ -96,7 +96,7 @@ set_form_page(FORM *form, int page)
 |   Return Values :  >= 0  : current page number
 |                    -1    : invalid form pointer
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 form_page(const FORM *form)
 {
   T((T_CALLED("form_page(%p)"), (const void *)form));
diff --git a/form/frm_post.c b/form/frm_post.c
index 2f1ad813..894c7c4c 100644
--- a/form/frm_post.c
+++ b/form/frm_post.c
@@ -48,7 +48,7 @@ MODULE_ID("$Id: frm_post.c,v 1.13 2020/02/02 23:34:34 tom Exp $")
 |                    E_NO_ROOM         - form doesn't fit into subwindow
 |                    E_SYSTEM_ERROR    - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 post_form(FORM *form)
 {
   WINDOW *formwin;
@@ -98,7 +98,7 @@ post_form(FORM *form)
 |                    E_NOT_POSTED    - form isn't posted
 |                    E_BAD_STATE     - called from a hook routine
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 unpost_form(FORM *form)
 {
   T((T_CALLED("unpost_form(%p)"), (void *)form));
diff --git a/form/frm_req_name.c b/form/frm_req_name.c
index 1e56c3dc..2f734f18 100644
--- a/form/frm_req_name.c
+++ b/form/frm_req_name.c
@@ -120,7 +120,7 @@ static const char request_names[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1][13] =
 |   Return Values :  Pointer to name      - on success
 |                    NULL                 - on invalid request code
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(const char *)
+FORM_EXPORT(const char *)
 form_request_name(int request)
 {
   T((T_CALLED("form_request_name(%d)"), request));
@@ -143,7 +143,7 @@ form_request_name(int request)
 |   Return Values :  Request Id       - on success
 |                    E_NO_MATCH       - request not found
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 form_request_by_name(const char *str)
 {
   /* because the table is so small, it doesn't really hurt
diff --git a/form/frm_scale.c b/form/frm_scale.c
index 34c3611d..e0e025aa 100644
--- a/form/frm_scale.c
+++ b/form/frm_scale.c
@@ -45,7 +45,7 @@ MODULE_ID("$Id: frm_scale.c,v 1.11 2020/02/02 23:34:34 tom Exp $")
 |                    E_BAD_ARGUMENT    - invalid form pointer
 |                    E_NOT_CONNECTED   - no fields connected to form
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 scale_form(const FORM *form, int *rows, int *cols)
 {
   T((T_CALLED("scale_form(%p,%p,%p)"),
diff --git a/form/frm_sub.c b/form/frm_sub.c
index 9621e302..ebfcb10d 100644
--- a/form/frm_sub.c
+++ b/form/frm_sub.c
@@ -44,7 +44,7 @@ MODULE_ID("$Id: frm_sub.c,v 1.13 2020/02/02 23:34:34 tom Exp $")
 |   Return Values :  E_OK       - success
 |                    E_POSTED   - form is posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_form_sub(FORM *form, WINDOW *win)
 {
   T((T_CALLED("set_form_sub(%p,%p)"), (void *)form, (void *)win));
@@ -73,7 +73,7 @@ set_form_sub(FORM *form, WINDOW *win)
 |
 |   Return Values :  The pointer to the Subwindow.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(WINDOW *)
+FORM_EXPORT(WINDOW *)
 form_sub(const FORM *form)
 {
   const FORM *f;
diff --git a/form/frm_user.c b/form/frm_user.c
index e1210f2d..2a415fbe 100644
--- a/form/frm_user.c
+++ b/form/frm_user.c
@@ -44,7 +44,7 @@ MODULE_ID("$Id: frm_user.c,v 1.16 2020/02/02 23:34:34 tom Exp $")
 |
 |   Return Values :  E_OK         - on success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_form_userptr(FORM *form, void *usrptr)
 {
   T((T_CALLED("set_form_userptr(%p,%p)"), (void *)form, (void *)usrptr));
@@ -63,7 +63,7 @@ set_form_userptr(FORM *form, void *usrptr)
 |   Return Values :  Value of pointer. If no such pointer has been set,
 |                    NULL is returned
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void *)
+FORM_EXPORT(void *)
 form_userptr(const FORM *form)
 {
   T((T_CALLED("form_userptr(%p)"), (const void *)form));
diff --git a/form/frm_win.c b/form/frm_win.c
index b7d1272d..465ceb3c 100644
--- a/form/frm_win.c
+++ b/form/frm_win.c
@@ -44,7 +44,7 @@ MODULE_ID("$Id: frm_win.c,v 1.17 2020/02/02 23:34:34 tom Exp $")
 |   Return Values :  E_OK       - success
 |                    E_POSTED   - form is posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_form_win(FORM *form, WINDOW *win)
 {
   T((T_CALLED("set_form_win(%p,%p)"), (void *)form, (void *)win));
@@ -73,7 +73,7 @@ set_form_win(FORM *form, WINDOW *win)
 |
 |   Return Values :  The pointer to the Window or stdscr if there is none.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(WINDOW *)
+FORM_EXPORT(WINDOW *)
 form_win(const FORM *form)
 {
   WINDOW *result;
diff --git a/form/fty_alnum.c b/form/fty_alnum.c
index a2ca3514..5504ba98 100644
--- a/form/fty_alnum.c
+++ b/form/fty_alnum.c
@@ -186,14 +186,14 @@ static FIELDTYPE typeTHIS =
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALNUM = &typeTHIS;
+FORM_EXPORT_VAR(FIELDTYPE*) TYPE_ALNUM = &typeTHIS;
 
 #if NCURSES_INTEROP_FUNCS
 /* The next routines are to simplify the use of ncurses from
    programming languages with restictions on interop with C level
    constructs (e.g. variable access or va_list + ellipsis constructs)
 */
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_ALNUM(void)
 {
   return TYPE_ALNUM;
diff --git a/form/fty_alpha.c b/form/fty_alpha.c
index 7dec23f5..15e27143 100644
--- a/form/fty_alpha.c
+++ b/form/fty_alpha.c
@@ -186,14 +186,14 @@ static FIELDTYPE typeTHIS =
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALPHA = &typeTHIS;
+FORM_EXPORT_VAR(FIELDTYPE*) TYPE_ALPHA = &typeTHIS;
 
 #if NCURSES_INTEROP_FUNCS
 /* The next routines are to simplify the use of ncurses from
    programming languages with restictions on interop with C level
    constructs (e.g. variable access or va_list + ellipsis constructs)
 */
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_ALPHA(void)
 {
   return TYPE_ALPHA;
diff --git a/form/fty_enum.c b/form/fty_enum.c
index 71978e3a..2633eff4 100644
--- a/form/fty_enum.c
+++ b/form/fty_enum.c
@@ -425,7 +425,7 @@ static FIELDTYPE typeENUM =
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE *)
+FORM_EXPORT_VAR(FIELDTYPE *)
 TYPE_ENUM = &typeENUM;
 
 #if NCURSES_INTEROP_FUNCS
@@ -433,7 +433,7 @@ TYPE_ENUM = &typeENUM;
    programming languages with restictions on interop with C level
    constructs (e.g. variable access or va_list + ellipsis constructs)
 */
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_ENUM(void)
 {
   return TYPE_ENUM;
diff --git a/form/fty_generic.c b/form/fty_generic.c
index 159d3059..f4332f43 100644
--- a/form/fty_generic.c
+++ b/form/fty_generic.c
@@ -99,7 +99,7 @@ Generic_This_Type(void *arg)
 |
 |   Return Values :  Fieldtype pointer or NULL if error occurred
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_generic_fieldtype(bool (*const field_check) (FORM *, FIELD *, const void *),
 		      bool (*const char_check) (int, FORM *, FIELD *, const
 						void *),
@@ -220,7 +220,7 @@ GenericArgument(const FIELDTYPE *typ,
 |   Return Values :  E_OK if all went well
 |                    E_SYSTEM_ERROR if an error occurred
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 _nc_set_generic_fieldtype(FIELD *field,
 			  FIELDTYPE *ftyp,
 			  int (*argiterator) (void **))
@@ -275,7 +275,7 @@ _nc_set_generic_fieldtype(FIELD *field,
 |
 |   Return Values :  The fields Window or NULL on error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(WINDOW *)
+FORM_EXPORT(WINDOW *)
 _nc_form_cursor(const FORM *form, int *pRow, int *pCol)
 {
   int code = E_SYSTEM_ERROR;
diff --git a/form/fty_int.c b/form/fty_int.c
index 71056404..5e619462 100644
--- a/form/fty_int.c
+++ b/form/fty_int.c
@@ -278,14 +278,14 @@ static FIELDTYPE typeTHIS =
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_INTEGER = &typeTHIS;
+FORM_EXPORT_VAR(FIELDTYPE*) TYPE_INTEGER = &typeTHIS;
 
 #if NCURSES_INTEROP_FUNCS
 /* The next routines are to simplify the use of ncurses from
    programming languages with restictions on interop with C level
    constructs (e.g. variable access or va_list + ellipsis constructs)
 */
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_INTEGER(void)
 {
   return TYPE_INTEGER;
diff --git a/form/fty_ipv4.c b/form/fty_ipv4.c
index 37133770..6d558668 100644
--- a/form/fty_ipv4.c
+++ b/form/fty_ipv4.c
@@ -104,14 +104,14 @@ static FIELDTYPE typeIPV4 =
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_IPV4 = &typeIPV4;
+FORM_EXPORT_VAR(FIELDTYPE*) TYPE_IPV4 = &typeIPV4;
 
 #if NCURSES_INTEROP_FUNCS
 /* The next routines are to simplify the use of ncurses from
    programming languages with restictions on interop with C level
    constructs (e.g. variable access or va_list + ellipsis constructs)
 */
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_IPV4(void)
 {
   return TYPE_IPV4;
diff --git a/form/fty_num.c b/form/fty_num.c
index b4dfeb97..8216cd74 100644
--- a/form/fty_num.c
+++ b/form/fty_num.c
@@ -324,14 +324,14 @@ static FIELDTYPE typeTHIS =
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_NUMERIC = &typeTHIS;
+FORM_EXPORT_VAR(FIELDTYPE*) TYPE_NUMERIC = &typeTHIS;
 
 #if NCURSES_INTEROP_FUNCS
 /* The next routines are to simplify the use of ncurses from
    programming languages with restictions on interop with C level
    constructs (e.g. variable access or va_list + ellipsis constructs)
 */
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_NUMERIC(void)
 {
   return TYPE_NUMERIC;
diff --git a/form/fty_regex.c b/form/fty_regex.c
index d1daf714..61378050 100644
--- a/form/fty_regex.c
+++ b/form/fty_regex.c
@@ -340,14 +340,14 @@ static FIELDTYPE typeREGEXP =
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_REGEXP = &typeREGEXP;
+FORM_EXPORT_VAR(FIELDTYPE*) TYPE_REGEXP = &typeREGEXP;
 
 #if NCURSES_INTEROP_FUNCS
 /* The next routines are to simplify the use of ncurses from
    programming languages with restictions on interop with C level
    constructs (e.g. variable access or va_list + ellipsis constructs)
 */
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_REGEXP(void)
 {
   return TYPE_REGEXP;
diff --git a/include/ncurses_dll.h.in b/include/ncurses_dll.h.in
index 568112e2..ca1f0749 100644
--- a/include/ncurses_dll.h.in
+++ b/include/ncurses_dll.h.in
@@ -66,7 +66,6 @@
  * using functions to access them.
  */
 #define NCURSES_PUBLIC_VAR(name) @NCURSES_WRAP_PREFIX@##name
-#define NCURSES_WRAPPED_VAR(type,name) extern type NCURSES_PUBLIC_VAR(name)(void)
 
 #include "ncurses_exports.h"
 
@@ -76,6 +75,8 @@
 # define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
 #endif
 
+#define NCURSES_WRAPPED_VAR(type,name) extern NCURSES_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
+
 #define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
 #define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
 
--- include/nc_mingw.h
+++ include/nc_mingw.h
@@ -60,7 +60,9 @@
 #include <winsock2.h>		/* for struct timeval */
 #endif
 
-extern int _nc_gettimeofday(struct timeval *, void *);
+#include <ncurses_dll.h>
+
+NCURSES_EXPORT(int) _nc_gettimeofday(struct timeval *, void *);
 
 #undef HAVE_GETTIMEOFDAY
 #define HAVE_GETTIMEOFDAY 1
@@ -71,7 +73,7 @@ extern int _nc_gettimeofday(struct timeval *, void *);
 
 #undef wcwidth
 #define wcwidth(ucs) _nc_wcwidth((wchar_t)(ucs))
-extern int _nc_wcwidth(wchar_t);
+NCURSES_EXPORT(int) _nc_wcwidth(wchar_t);
 
 #endif /* _WIN32 */
 
diff --git a/menu/m_cursor.c b/menu/m_cursor.c
index 3f8e5480..786d9e6c 100644
--- a/menu/m_cursor.c
+++ b/menu/m_cursor.c
@@ -50,7 +50,7 @@ MODULE_ID("$Id: m_cursor.c,v 1.23 2020/02/02 23:34:34 tom Exp $")
 |                    E_BAD_ARGUMENT  - invalid menu
 |                    E_NOT_POSTED    - Menu is not posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 _nc_menu_cursor_pos(const MENU * menu, const ITEM * item, int *pY, int *pX)
 {
   if (!menu || !pX || !pY)
@@ -80,7 +80,7 @@ _nc_menu_cursor_pos(const MENU * menu, const ITEM * item, int *pY, int *pX)
 |                    E_BAD_ARGUMENT  - invalid menu
 |                    E_NOT_POSTED    - Menu is not posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 pos_menu_cursor(const MENU * menu)
 {
   WINDOW *win, *sub;
diff --git a/menu/m_driver.c b/menu/m_driver.c
index e592bab4..98d7fdf1 100644
--- a/menu/m_driver.c
+++ b/menu/m_driver.c
@@ -115,7 +115,7 @@ Is_Sub_String(
 |   Return Values :  E_OK        - an item matching the pattern was found
 |                    E_NO_MATCH  - nothing found
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 _nc_Match_Next_Character_In_Item_Name
 (MENU * menu, int ch, ITEM ** item)
 {
@@ -209,7 +209,7 @@ _nc_Match_Next_Character_In_Item_Name
 |                    E_BAD_STATE     - menu is in user hook routine
 |                    E_NOT_POSTED    - menu is not posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 menu_driver(MENU * menu, int c)
 {
 #define NAVIGATE(dir) \
diff --git a/menu/m_format.c b/menu/m_format.c
index 9738dbf2..96d331e4 100644
--- a/menu/m_format.c
+++ b/menu/m_format.c
@@ -56,7 +56,7 @@ MODULE_ID("$Id: m_format.c,v 1.19 2020/02/02 23:34:34 tom Exp $")
 |                    E_NOT_CONNECTED        - there are no items connected
 |                    E_POSTED               - the menu is already posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 set_menu_format(MENU * menu, int rows, int cols)
 {
   int total_rows, total_cols;
@@ -120,7 +120,7 @@ set_menu_format(MENU * menu, int rows, int cols)
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+MENU_EXPORT(void)
 menu_format(const MENU * menu, int *rows, int *cols)
 {
   if (rows)
diff --git a/menu/m_global.c b/menu/m_global.c
index 489987fe..f2d6c001 100644
--- a/menu/m_global.c
+++ b/menu/m_global.c
@@ -42,7 +42,7 @@ MODULE_ID("$Id: m_global.c,v 1.30 2020/02/02 23:34:34 tom Exp $")
 
 static char mark[] = "-";
 /* *INDENT-OFF* */
-NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu = {
+MENU_EXPORT_VAR(MENU) _nc_Default_Menu = {
   16,				  /* Nr. of chars high */
   1,				  /* Nr. of chars wide */
   16,				  /* Nr. of items high */
@@ -81,7 +81,7 @@ NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu = {
   0			          /* status */
 };
 
-NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item = {
+MENU_EXPORT_VAR(ITEM) _nc_Default_Item = {
   { (char *)0, 0 },		  /* name */
   { (char *)0, 0 },		  /* description */
   (MENU *)0,		          /* Pointer to parent menu */
@@ -171,7 +171,7 @@ ResetConnectionInfo(MENU * menu, ITEM ** items)
 |   Return Values :  TRUE       - successful connection
 |                    FALSE      - connection failed
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+MENU_EXPORT(bool)
 _nc_Connect_Items(MENU * menu, ITEM ** items)
 {
   ITEM **item;
@@ -233,7 +233,7 @@ _nc_Connect_Items(MENU * menu, ITEM ** items)
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+MENU_EXPORT(void)
 _nc_Disconnect_Items(MENU * menu)
 {
   if (menu && menu->items)
@@ -248,7 +248,7 @@ _nc_Disconnect_Items(MENU * menu)
 |
 |   Return Values :  the width
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 _nc_Calculate_Text_Width(const TEXT * item /*FIXME: limit length */ )
 {
 #if USE_WIDEC_SUPPORT
@@ -337,7 +337,7 @@ calculate_actual_width(MENU * menu, bool name)
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+MENU_EXPORT(void)
 _nc_Calculate_Item_Length_and_Width(MENU * menu)
 {
   int l;
@@ -376,7 +376,7 @@ _nc_Calculate_Item_Length_and_Width(MENU * menu)
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+MENU_EXPORT(void)
 _nc_Link_Items(MENU * menu)
 {
   if (menu && menu->items && *(menu->items))
@@ -503,7 +503,7 @@ _nc_Link_Items(MENU * menu)
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+MENU_EXPORT(void)
 _nc_Show_Menu(const MENU * menu)
 {
   WINDOW *win;
@@ -543,7 +543,7 @@ _nc_Show_Menu(const MENU * menu)
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+MENU_EXPORT(void)
 _nc_New_TopRow_and_CurrentItem(
 				MENU * menu,
 				int new_toprow,
diff --git a/menu/m_item_cur.c b/menu/m_item_cur.c
index c09bf311..10435e7a 100644
--- a/menu/m_item_cur.c
+++ b/menu/m_item_cur.c
@@ -48,7 +48,7 @@ MODULE_ID("$Id: m_item_cur.c,v 1.19 2020/02/02 23:34:34 tom Exp $")
 |
 |   Return Values :  E_OK                - success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 set_current_item(MENU * menu, ITEM * item)
 {
   T((T_CALLED("set_current_item(%p,%p)"), (void *)menu, (void *)item));
@@ -89,7 +89,7 @@ set_current_item(MENU * menu, ITEM * item)
 |
 |   Return Values :  Item pointer or NULL if failure
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(ITEM *)
+MENU_EXPORT(ITEM *)
 current_item(const MENU * menu)
 {
   T((T_CALLED("current_item(%p)"), (const void *)menu));
@@ -104,7 +104,7 @@ current_item(const MENU * menu)
 |
 |   Return Values :  The index or ERR if this is an invalid item pointer
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 item_index(const ITEM * item)
 {
   T((T_CALLED("item_index(%p)"), (const void *)item));
diff --git a/menu/m_item_nam.c b/menu/m_item_nam.c
index aaf54e0a..dc4d66c6 100644
--- a/menu/m_item_nam.c
+++ b/menu/m_item_nam.c
@@ -48,7 +48,7 @@ MODULE_ID("$Id: m_item_nam.c,v 1.16 2020/02/02 23:34:34 tom Exp $")
 |
 |   Return Values :  See above; returns NULL if item is invalid
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(const char *)
+MENU_EXPORT(const char *)
 item_name(const ITEM * item)
 {
   T((T_CALLED("item_name(%p)"), (const void *)item));
@@ -63,7 +63,7 @@ item_name(const ITEM * item)
 |
 |   Return Values :  See above; Returns NULL if item is invalid
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(const char *)
+MENU_EXPORT(const char *)
 item_description(const ITEM * item)
 {
   T((T_CALLED("item_description(%p)"), (const void *)item));
diff --git a/menu/m_item_new.c b/menu/m_item_new.c
index 1e7950db..493977ad 100644
--- a/menu/m_item_new.c
+++ b/menu/m_item_new.c
@@ -107,7 +107,7 @@ Is_Printable_String(const char *s)
 |
 |   Return Values :  The item pointer or NULL if creation failed.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(ITEM *)
+MENU_EXPORT(ITEM *)
 new_item(const char *name, const char *description)
 {
   ITEM *item;
@@ -160,7 +160,7 @@ new_item(const char *name, const char *description)
 |                    E_BAD_ARGUMENT    - invalid value has been passed
 |                    E_CONNECTED       - item is still connected to a menu    
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 free_item(ITEM * item)
 {
   T((T_CALLED("free_item(%p)"), (void *)item));
@@ -193,7 +193,7 @@ free_item(ITEM * item)
 |                    E_BAD_ARGUMENT     - an invalid value has been passed
 |                    E_SYSTEM_ERROR     - no memory to store mark
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 set_menu_mark(MENU * menu, const char *mark)
 {
   short l;
@@ -265,7 +265,7 @@ set_menu_mark(MENU * menu, const char *mark)
 |
 |   Return Values :  The marker string pointer or NULL if no marker defined
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(const char *)
+MENU_EXPORT(const char *)
 menu_mark(const MENU * menu)
 {
   T((T_CALLED("menu_mark(%p)"), (const void *)menu));
diff --git a/menu/m_item_opt.c b/menu/m_item_opt.c
index f8df2205..b6a5e151 100644
--- a/menu/m_item_opt.c
+++ b/menu/m_item_opt.c
@@ -51,7 +51,7 @@ MODULE_ID("$Id: m_item_opt.c,v 1.19 2020/02/02 23:34:34 tom Exp $")
 |   Return Values :  E_OK            - success
 |                    E_BAD_ARGUMENT  - invalid item options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 set_item_opts(ITEM * item, Item_Options opts)
 {
   T((T_CALLED("set_menu_opts(%p,%d)"), (void *)item, opts));
@@ -94,7 +94,7 @@ set_item_opts(ITEM * item, Item_Options opts)
 |   Return Values :  E_OK            - success
 |                    E_BAD_ARGUMENT  - invalid options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 item_opts_off(ITEM * item, Item_Options opts)
 {
   ITEM *citem = item;		/* use a copy because set_item_opts must detect
@@ -122,7 +122,7 @@ item_opts_off(ITEM * item, Item_Options opts)
 |   Return Values :  E_OK            - success
 |                    E_BAD_ARGUMENT  - invalid options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 item_opts_on(ITEM * item, Item_Options opts)
 {
   ITEM *citem = item;		/* use a copy because set_item_opts must detect
@@ -150,7 +150,7 @@ item_opts_on(ITEM * item, Item_Options opts)
 |
 |   Return Values :  Items options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(Item_Options)
+MENU_EXPORT(Item_Options)
 item_opts(const ITEM * item)
 {
   T((T_CALLED("item_opts(%p)"), (const void *)item));
diff --git a/menu/m_item_top.c b/menu/m_item_top.c
index 9417e72b..ab60e0f9 100644
--- a/menu/m_item_top.c
+++ b/menu/m_item_top.c
@@ -50,7 +50,7 @@ MODULE_ID("$Id: m_item_top.c,v 1.12 2020/02/02 23:34:34 tom Exp $")
 |                    E_BAD_ARGUMENT   - not a menu pointer or invalid row
 |                    E_NOT_CONNECTED  - there are no items for the menu
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 set_top_row(MENU * menu, int row)
 {
   ITEM *item;
@@ -92,7 +92,7 @@ set_top_row(MENU * menu, int row)
 |
 |   Return Values :  The row number or ERR if there is no row
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 top_row(const MENU * menu)
 {
   T((T_CALLED("top_row(%p)"), (const void *)menu));
diff --git a/menu/m_item_use.c b/menu/m_item_use.c
index 30814327..a2e6cfa6 100644
--- a/menu/m_item_use.c
+++ b/menu/m_item_use.c
@@ -49,7 +49,7 @@ MODULE_ID("$Id: m_item_use.c,v 1.19 2020/02/02 23:34:34 tom Exp $")
 |
 |   Return Values :  E_OK               - success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 set_item_userptr(ITEM * item, void *userptr)
 {
   T((T_CALLED("set_item_userptr(%p,%p)"), (void *)item, (void *)userptr));
@@ -67,7 +67,7 @@ set_item_userptr(ITEM * item, void *userptr)
 |   Return Values :  Value of the pointer. If no such pointer has been set,
 |                    NULL is returned.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void *)
+MENU_EXPORT(void *)
 item_userptr(const ITEM * item)
 {
   T((T_CALLED("item_userptr(%p)"), (const void *)item));
diff --git a/menu/m_item_val.c b/menu/m_item_val.c
index d8d11f21..825c9a2f 100644
--- a/menu/m_item_val.c
+++ b/menu/m_item_val.c
@@ -53,7 +53,7 @@ MODULE_ID("$Id: m_item_val.c,v 1.16 2020/02/02 23:34:34 tom Exp $")
 |   Return Values :  E_OK              - success
 |                    E_REQUEST_DENIED  - not selectable or single valued menu
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 set_item_value(ITEM * item, bool value)
 {
   MENU *menu;
@@ -95,7 +95,7 @@ set_item_value(ITEM * item, bool value)
 |   Return Values :  TRUE   - if item is selected
 |                    FALSE  - if item is not selected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+MENU_EXPORT(bool)
 item_value(const ITEM * item)
 {
   T((T_CALLED("item_value(%p)"), (const void *)item));
diff --git a/menu/m_item_vis.c b/menu/m_item_vis.c
index 8e993413..5959548a 100644
--- a/menu/m_item_vis.c
+++ b/menu/m_item_vis.c
@@ -50,7 +50,7 @@ MODULE_ID("$Id: m_item_vis.c,v 1.17 2020/02/02 23:34:34 tom Exp $")
 |   Return Values :  TRUE  if visible
 |                    FALSE if invisible
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+MENU_EXPORT(bool)
 item_visible(const ITEM * item)
 {
   MENU *menu;
diff --git a/menu/m_items.c b/menu/m_items.c
index 9f46c8be..8c6d4bfc 100644
--- a/menu/m_items.c
+++ b/menu/m_items.c
@@ -53,7 +53,7 @@ MODULE_ID("$Id: m_items.c,v 1.18 2020/02/02 23:34:34 tom Exp $")
 |                    E_BAD_ARGUMENT - An incorrect menu or item array was
 |                                     passed to the function
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 set_menu_items(MENU * menu, ITEM ** items)
 {
   T((T_CALLED("set_menu_items(%p,%p)"), (void *)menu, (void *)items));
@@ -85,7 +85,7 @@ set_menu_items(MENU * menu, ITEM ** items)
 |
 |   Return Values :  NULL on error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(ITEM **)
+MENU_EXPORT(ITEM **)
 menu_items(const MENU * menu)
 {
   T((T_CALLED("menu_items(%p)"), (const void *)menu));
@@ -101,7 +101,7 @@ menu_items(const MENU * menu)
 |
 |   Return Values :  Number of items or -1 to indicate error.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 item_count(const MENU * menu)
 {
   T((T_CALLED("item_count(%p)"), (const void *)menu));
diff --git a/menu/m_new.c b/menu/m_new.c
index cf89196a..f78c702c 100644
--- a/menu/m_new.c
+++ b/menu/m_new.c
@@ -51,7 +51,7 @@ MODULE_ID("$Id: m_new.c,v 1.22 2020/02/02 23:34:34 tom Exp $")
 |
 |   Return Values :  NULL on error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(MENU *)
+MENU_EXPORT(MENU *)
 NCURSES_SP_NAME(new_menu) (NCURSES_SP_DCLx ITEM ** items)
 {
   int err = E_SYSTEM_ERROR;
@@ -102,7 +102,7 @@ NCURSES_SP_NAME(new_menu) (NCURSES_SP_DCLx ITEM ** items)
 |   Return Values :  NULL on error
 +--------------------------------------------------------------------------*/
 #if NCURSES_SP_FUNCS
-NCURSES_EXPORT(MENU *)
+MENU_EXPORT(MENU *)
 new_menu(ITEM ** items)
 {
   return NCURSES_SP_NAME(new_menu) (CURRENT_SCREEN, items);
@@ -120,7 +120,7 @@ new_menu(ITEM ** items)
 |                    E_BAD_ARGUMENT     - Invalid menu pointer passed
 |                    E_POSTED           - Menu is already posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 free_menu(MENU * menu)
 {
   T((T_CALLED("free_menu(%p)"), (void *)menu));
diff --git a/menu/m_opts.c b/menu/m_opts.c
index 4c29f333..b8dc653d 100644
--- a/menu/m_opts.c
+++ b/menu/m_opts.c
@@ -53,7 +53,7 @@ MODULE_ID("$Id: m_opts.c,v 1.21 2020/02/02 23:34:34 tom Exp $")
 |                    E_BAD_ARGUMENT - invalid menu options
 |                    E_POSTED       - menu is already posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 set_menu_opts(MENU * menu, Menu_Options opts)
 {
   T((T_CALLED("set_menu_opts(%p,%d)"), (void *)menu, opts));
@@ -113,7 +113,7 @@ set_menu_opts(MENU * menu, Menu_Options opts)
 |                    E_BAD_ARGUMENT - invalid options
 |                    E_POSTED       - menu is already posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 menu_opts_off(MENU * menu, Menu_Options opts)
 {
   MENU *cmenu = menu;		/* use a copy because set_menu_opts must detect
@@ -146,7 +146,7 @@ menu_opts_off(MENU * menu, Menu_Options opts)
 |                    E_BAD_ARGUMENT - invalid menu options
 |                    E_POSTED       - menu is already posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 menu_opts_on(MENU * menu, Menu_Options opts)
 {
   MENU *cmenu = menu;		/* use a copy because set_menu_opts must detect
@@ -174,7 +174,7 @@ menu_opts_on(MENU * menu, Menu_Options opts)
 |
 |   Return Values :  Menu options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(Menu_Options)
+MENU_EXPORT(Menu_Options)
 menu_opts(const MENU * menu)
 {
   T((T_CALLED("menu_opts(%p)"), (const void *)menu));
diff --git a/menu/m_pad.c b/menu/m_pad.c
index 3d5702ae..e56d3748 100644
--- a/menu/m_pad.c
+++ b/menu/m_pad.c
@@ -59,7 +59,7 @@ MODULE_ID("$Id: m_pad.c,v 1.14 2020/02/02 23:34:34 tom Exp $")
 |   Return Values :  E_OK              - success
 |                    E_BAD_ARGUMENT    - an invalid value has been passed
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 set_menu_pad(MENU * menu, int pad)
 {
   bool do_refresh = (menu != (MENU *) 0);
@@ -86,7 +86,7 @@ set_menu_pad(MENU * menu, int pad)
 |
 |   Return Values :  The pad character
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 menu_pad(const MENU * menu)
 {
   T((T_CALLED("menu_pad(%p)"), (const void *)menu));
diff --git a/menu/m_pattern.c b/menu/m_pattern.c
index 9ff02304..f91f3223 100644
--- a/menu/m_pattern.c
+++ b/menu/m_pattern.c
@@ -51,7 +51,7 @@ MODULE_ID("$Id: m_pattern.c,v 1.17 2020/02/02 23:34:34 tom Exp $")
 |                                    pattern is stored
 |                    PatternString - as expected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(char *)
+MENU_EXPORT(char *)
 menu_pattern(const MENU * menu)
 {
   static char empty[] = "";
@@ -73,7 +73,7 @@ menu_pattern(const MENU * menu)
 |                    E_NOT_CONNECTED   - no items connected to menu
 |                    E_NO_MATCH        - no item matches pattern
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 set_menu_pattern(MENU * menu, const char *p)
 {
   ITEM *matchitem;
diff --git a/menu/m_post.c b/menu/m_post.c
index 2cc0ea09..6d81b7c9 100644
--- a/menu/m_post.c
+++ b/menu/m_post.c
@@ -49,7 +49,7 @@ MODULE_ID("$Id: m_post.c,v 1.32 2020/02/02 23:34:34 tom Exp $")
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+MENU_EXPORT(void)
 _nc_Post_Item(const MENU * menu, const ITEM * item)
 {
   int i;
@@ -197,7 +197,7 @@ _nc_Post_Item(const MENU * menu, const ITEM * item)
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+MENU_EXPORT(void)
 _nc_Draw_Menu(const MENU * menu)
 {
   ITEM *item = menu->items[0];
@@ -267,7 +267,7 @@ _nc_Draw_Menu(const MENU * menu)
 |                    E_BAD_STATE         - Menu in userexit routine
 |                    E_POSTED            - Menu already posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 post_menu(MENU * menu)
 {
   T((T_CALLED("post_menu(%p)"), (void *)menu));
@@ -339,7 +339,7 @@ post_menu(MENU * menu)
 |                    E_BAD_STATE       - menu in userexit routine
 |                    E_NOT_POSTED      - menu is not posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 unpost_menu(MENU * menu)
 {
   WINDOW *win;
diff --git a/menu/m_req_name.c b/menu/m_req_name.c
index d3f04c1d..beeea0f1 100644
--- a/menu/m_req_name.c
+++ b/menu/m_req_name.c
@@ -74,7 +74,7 @@ static const char request_names[MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1][14] =
 |   Return Values :  Pointer to name      - on success
 |                    NULL                 - on invalid request code
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(const char *)
+MENU_EXPORT(const char *)
 menu_request_name(int request)
 {
   T((T_CALLED("menu_request_name(%d)"), request));
@@ -96,7 +96,7 @@ menu_request_name(int request)
 |   Return Values :  Request Id       - on success
 |                    E_NO_MATCH       - request not found
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 menu_request_by_name(const char *str)
 {
   /* because the table is so small, it doesn't really hurt
diff --git a/menu/m_scale.c b/menu/m_scale.c
index e013acd8..ba986955 100644
--- a/menu/m_scale.c
+++ b/menu/m_scale.c
@@ -51,7 +51,7 @@ MODULE_ID("$Id: m_scale.c,v 1.11 2020/02/02 23:34:34 tom Exp $")
 |                    E_BAD_ARGUMENT        - invalid menu pointer
 |                    E_NOT_CONNECTED       - no items are connected to menu
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 scale_menu(const MENU * menu, int *rows, int *cols)
 {
   T((T_CALLED("scale_menu(%p,%p,%p)"),
diff --git a/menu/m_spacing.c b/menu/m_spacing.c
index 9bb746a0..6d68e268 100644
--- a/menu/m_spacing.c
+++ b/menu/m_spacing.c
@@ -52,7 +52,7 @@ MODULE_ID("$Id: m_spacing.c,v 1.20 2020/02/02 23:34:34 tom Exp $")
 |
 |   Return Values :  E_OK                 - on success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 set_menu_spacing(MENU * menu, int s_desc, int s_row, int s_col)
 {
   MENU *m;			/* split for ATAC workaround */
@@ -87,7 +87,7 @@ set_menu_spacing(MENU * menu, int s_desc, int s_row, int s_col)
 |
 |   Return Values :  E_OK             - on success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 menu_spacing(const MENU * menu, int *s_desc, int *s_row, int *s_col)
 {
   const MENU *m;		/* split for ATAC workaround */
diff --git a/menu/m_sub.c b/menu/m_sub.c
index 4658e90e..e69994d5 100644
--- a/menu/m_sub.c
+++ b/menu/m_sub.c
@@ -49,7 +49,7 @@ MODULE_ID("$Id: m_sub.c,v 1.13 2020/02/02 23:34:34 tom Exp $")
 |   Return Values :  E_OK           - success
 |                    E_POSTED       - menu is already posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 set_menu_sub(MENU * menu, WINDOW *win)
 {
   T((T_CALLED("set_menu_sub(%p,%p)"), (void *)menu, (void *)win));
@@ -89,7 +89,7 @@ set_menu_sub(MENU * menu, WINDOW *win)
 |
 |   Return Values :  NULL on error, otherwise a pointer to the window
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(WINDOW *)
+MENU_EXPORT(WINDOW *)
 menu_sub(const MENU * menu)
 {
   const MENU *m = Normalize_Menu(menu);
diff --git a/menu/m_trace.c b/menu/m_trace.c
index f5332b18..f4d3373d 100644
--- a/menu/m_trace.c
+++ b/menu/m_trace.c
@@ -35,35 +35,35 @@
 
 MODULE_ID("$Id: m_trace.c,v 1.7 2020/02/02 23:34:34 tom Exp $")
 
-NCURSES_EXPORT(ITEM *)
+MENU_EXPORT(ITEM *)
 _nc_retrace_item(ITEM * code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(ITEM **)
+MENU_EXPORT(ITEM **)
 _nc_retrace_item_ptr(ITEM ** code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(Item_Options)
+MENU_EXPORT(Item_Options)
 _nc_retrace_item_opts(Item_Options code)
 {
   T((T_RETURN("%d"), code));
   return code;
 }
 
-NCURSES_EXPORT(MENU *)
+MENU_EXPORT(MENU *)
 _nc_retrace_menu(MENU * code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(Menu_Hook)
+MENU_EXPORT(Menu_Hook)
 _nc_retrace_menu_hook(Menu_Hook code)
 {
   TR_FUNC_BFR(1);
@@ -71,7 +71,7 @@ _nc_retrace_menu_hook(Menu_Hook code)
   return code;
 }
 
-NCURSES_EXPORT(Menu_Options)
+MENU_EXPORT(Menu_Options)
 _nc_retrace_menu_opts(Menu_Options code)
 {
   T((T_RETURN("%d"), code));
diff --git a/menu/m_userptr.c b/menu/m_userptr.c
index df3a45f8..6b1ca551 100644
--- a/menu/m_userptr.c
+++ b/menu/m_userptr.c
@@ -49,7 +49,7 @@ MODULE_ID("$Id: m_userptr.c,v 1.19 2020/02/02 23:34:34 tom Exp $")
 |
 |   Return Values :  E_OK         - success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 set_menu_userptr(MENU * menu, void *userptr)
 {
   T((T_CALLED("set_menu_userptr(%p,%p)"), (void *)menu, (void *)userptr));
@@ -67,7 +67,7 @@ set_menu_userptr(MENU * menu, void *userptr)
 |   Return Values :  Value of the pointer. If no such pointer has been set,
 |                    NULL is returned
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void *)
+MENU_EXPORT(void *)
 menu_userptr(const MENU * menu)
 {
   T((T_CALLED("menu_userptr(%p)"), (const void *)menu));
diff --git a/menu/m_win.c b/menu/m_win.c
index f06c5808..e67cc92e 100644
--- a/menu/m_win.c
+++ b/menu/m_win.c
@@ -49,7 +49,7 @@ MODULE_ID("$Id: m_win.c,v 1.18 2020/02/02 23:34:34 tom Exp $")
 |   Return Values :  E_OK               - success
 |                    E_POSTED           - menu is already posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 set_menu_win(MENU * menu, WINDOW *win)
 {
   T((T_CALLED("set_menu_win(%p,%p)"), (void *)menu, (void *)win));
@@ -89,7 +89,7 @@ set_menu_win(MENU * menu, WINDOW *win)
 |
 |   Return Values :  NULL on error, otherwise pointer to window
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(WINDOW *)
+MENU_EXPORT(WINDOW *)
 menu_win(const MENU * menu)
 {
   const MENU *m = Normalize_Menu(menu);
diff --git a/menu/menu.h b/menu/menu.h
index b2e845c6..09bc6c0a 100644
--- a/menu/menu.h
+++ b/menu/menu.h
@@ -47,6 +47,19 @@
 extern "C" {
 #endif
 
+#include "ncurses_exports.h"
+
+#if defined(BUILDING_MENU)
+# define MENU_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
+#else
+# define MENU_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
+#endif
+
+#define MENU_WRAPPED_VAR(type,name) extern MENU_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
+
+#define MENU_EXPORT(type) MENU_IMPEXP type NCURSES_API
+#define MENU_EXPORT_VAR(type) MENU_IMPEXP type
+
 typedef int Menu_Options;
 typedef int Item_Options;
 
@@ -183,85 +196,85 @@ MENU;
 
 /* --------- prototypes for libmenu functions ----------------------------- */
 
-extern NCURSES_EXPORT(ITEM **)	menu_items (const MENU *);
-extern NCURSES_EXPORT(ITEM *)	current_item (const MENU *);
-extern NCURSES_EXPORT(ITEM *)	new_item (const char *,const char *);
-
-extern NCURSES_EXPORT(MENU *)	new_menu (ITEM **);
-
-extern NCURSES_EXPORT(Item_Options)	item_opts (const ITEM *);
-extern NCURSES_EXPORT(Menu_Options)	menu_opts (const MENU *);
-
-extern NCURSES_EXPORT(Menu_Hook)	item_init (const MENU *);
-extern NCURSES_EXPORT(Menu_Hook)	item_term (const MENU *);
-extern NCURSES_EXPORT(Menu_Hook)	menu_init (const MENU *);
-extern NCURSES_EXPORT(Menu_Hook)	menu_term (const MENU *);
-
-extern NCURSES_EXPORT(WINDOW *)	menu_sub (const MENU *);
-extern NCURSES_EXPORT(WINDOW *)	menu_win (const MENU *);
-
-extern NCURSES_EXPORT(const char *)	item_description (const ITEM *);
-extern NCURSES_EXPORT(const char *)	item_name (const ITEM *);
-extern NCURSES_EXPORT(const char *)	menu_mark (const MENU *);
-extern NCURSES_EXPORT(const char *)	menu_request_name (int);
-
-extern NCURSES_EXPORT(char *)	menu_pattern (const MENU *);
-
-extern NCURSES_EXPORT(void *)	menu_userptr (const MENU *);
-extern NCURSES_EXPORT(void *)	item_userptr (const ITEM *);
-
-extern NCURSES_EXPORT(chtype)	menu_back (const MENU *);
-extern NCURSES_EXPORT(chtype)	menu_fore (const MENU *);
-extern NCURSES_EXPORT(chtype)	menu_grey (const MENU *);
-
-extern NCURSES_EXPORT(int)	free_item (ITEM *);
-extern NCURSES_EXPORT(int)	free_menu (MENU *);
-extern NCURSES_EXPORT(int)	item_count (const MENU *);
-extern NCURSES_EXPORT(int)	item_index (const ITEM *);
-extern NCURSES_EXPORT(int)	item_opts_off (ITEM *,Item_Options);
-extern NCURSES_EXPORT(int)	item_opts_on (ITEM *,Item_Options);
-extern NCURSES_EXPORT(int)	menu_driver (MENU *,int);
-extern NCURSES_EXPORT(int)	menu_opts_off (MENU *,Menu_Options);
-extern NCURSES_EXPORT(int)	menu_opts_on (MENU *,Menu_Options);
-extern NCURSES_EXPORT(int)	menu_pad (const MENU *);
-extern NCURSES_EXPORT(int)	pos_menu_cursor (const MENU *);
-extern NCURSES_EXPORT(int)	post_menu (MENU *);
-extern NCURSES_EXPORT(int)	scale_menu (const MENU *,int *,int *);
-extern NCURSES_EXPORT(int)	set_current_item (MENU *menu,ITEM *item);
-extern NCURSES_EXPORT(int)	set_item_init (MENU *, Menu_Hook);
-extern NCURSES_EXPORT(int)	set_item_opts (ITEM *,Item_Options);
-extern NCURSES_EXPORT(int)	set_item_term (MENU *, Menu_Hook);
-extern NCURSES_EXPORT(int)	set_item_userptr (ITEM *, void *);
-extern NCURSES_EXPORT(int)	set_item_value (ITEM *,bool);
-extern NCURSES_EXPORT(int)	set_menu_back (MENU *,chtype);
-extern NCURSES_EXPORT(int)	set_menu_fore (MENU *,chtype);
-extern NCURSES_EXPORT(int)	set_menu_format (MENU *,int,int);
-extern NCURSES_EXPORT(int)	set_menu_grey (MENU *,chtype);
-extern NCURSES_EXPORT(int)	set_menu_init (MENU *, Menu_Hook);
-extern NCURSES_EXPORT(int)	set_menu_items (MENU *,ITEM **);
-extern NCURSES_EXPORT(int)	set_menu_mark (MENU *, const char *);
-extern NCURSES_EXPORT(int)	set_menu_opts (MENU *,Menu_Options);
-extern NCURSES_EXPORT(int)	set_menu_pad (MENU *,int);
-extern NCURSES_EXPORT(int)	set_menu_pattern (MENU *,const char *);
-extern NCURSES_EXPORT(int)	set_menu_sub (MENU *,WINDOW *);
-extern NCURSES_EXPORT(int)	set_menu_term (MENU *, Menu_Hook);
-extern NCURSES_EXPORT(int)	set_menu_userptr (MENU *,void *);
-extern NCURSES_EXPORT(int)	set_menu_win (MENU *,WINDOW *);
-extern NCURSES_EXPORT(int)	set_top_row (MENU *,int);
-extern NCURSES_EXPORT(int)	top_row (const MENU *);
-extern NCURSES_EXPORT(int)	unpost_menu (MENU *);
-extern NCURSES_EXPORT(int)	menu_request_by_name (const char *);
-extern NCURSES_EXPORT(int)	set_menu_spacing (MENU *,int,int,int);
-extern NCURSES_EXPORT(int)	menu_spacing (const MENU *,int *,int *,int *);
-
-
-extern NCURSES_EXPORT(bool)	item_value (const ITEM *);
-extern NCURSES_EXPORT(bool)	item_visible (const ITEM *);
-
-extern NCURSES_EXPORT(void)	menu_format (const MENU *,int *,int *);
+extern MENU_EXPORT(ITEM **)	menu_items (const MENU *);
+extern MENU_EXPORT(ITEM *)	current_item (const MENU *);
+extern MENU_EXPORT(ITEM *)	new_item (const char *,const char *);
+
+extern MENU_EXPORT(MENU *)	new_menu (ITEM **);
+
+extern MENU_EXPORT(Item_Options)	item_opts (const ITEM *);
+extern MENU_EXPORT(Menu_Options)	menu_opts (const MENU *);
+
+extern MENU_EXPORT(Menu_Hook)	item_init (const MENU *);
+extern MENU_EXPORT(Menu_Hook)	item_term (const MENU *);
+extern MENU_EXPORT(Menu_Hook)	menu_init (const MENU *);
+extern MENU_EXPORT(Menu_Hook)	menu_term (const MENU *);
+
+extern MENU_EXPORT(WINDOW *)	menu_sub (const MENU *);
+extern MENU_EXPORT(WINDOW *)	menu_win (const MENU *);
+
+extern MENU_EXPORT(const char *)	item_description (const ITEM *);
+extern MENU_EXPORT(const char *)	item_name (const ITEM *);
+extern MENU_EXPORT(const char *)	menu_mark (const MENU *);
+extern MENU_EXPORT(const char *)	menu_request_name (int);
+
+extern MENU_EXPORT(char *)	menu_pattern (const MENU *);
+
+extern MENU_EXPORT(void *)	menu_userptr (const MENU *);
+extern MENU_EXPORT(void *)	item_userptr (const ITEM *);
+
+extern MENU_EXPORT(chtype)	menu_back (const MENU *);
+extern MENU_EXPORT(chtype)	menu_fore (const MENU *);
+extern MENU_EXPORT(chtype)	menu_grey (const MENU *);
+
+extern MENU_EXPORT(int)	free_item (ITEM *);
+extern MENU_EXPORT(int)	free_menu (MENU *);
+extern MENU_EXPORT(int)	item_count (const MENU *);
+extern MENU_EXPORT(int)	item_index (const ITEM *);
+extern MENU_EXPORT(int)	item_opts_off (ITEM *,Item_Options);
+extern MENU_EXPORT(int)	item_opts_on (ITEM *,Item_Options);
+extern MENU_EXPORT(int)	menu_driver (MENU *,int);
+extern MENU_EXPORT(int)	menu_opts_off (MENU *,Menu_Options);
+extern MENU_EXPORT(int)	menu_opts_on (MENU *,Menu_Options);
+extern MENU_EXPORT(int)	menu_pad (const MENU *);
+extern MENU_EXPORT(int)	pos_menu_cursor (const MENU *);
+extern MENU_EXPORT(int)	post_menu (MENU *);
+extern MENU_EXPORT(int)	scale_menu (const MENU *,int *,int *);
+extern MENU_EXPORT(int)	set_current_item (MENU *menu,ITEM *item);
+extern MENU_EXPORT(int)	set_item_init (MENU *, Menu_Hook);
+extern MENU_EXPORT(int)	set_item_opts (ITEM *,Item_Options);
+extern MENU_EXPORT(int)	set_item_term (MENU *, Menu_Hook);
+extern MENU_EXPORT(int)	set_item_userptr (ITEM *, void *);
+extern MENU_EXPORT(int)	set_item_value (ITEM *,bool);
+extern MENU_EXPORT(int)	set_menu_back (MENU *,chtype);
+extern MENU_EXPORT(int)	set_menu_fore (MENU *,chtype);
+extern MENU_EXPORT(int)	set_menu_format (MENU *,int,int);
+extern MENU_EXPORT(int)	set_menu_grey (MENU *,chtype);
+extern MENU_EXPORT(int)	set_menu_init (MENU *, Menu_Hook);
+extern MENU_EXPORT(int)	set_menu_items (MENU *,ITEM **);
+extern MENU_EXPORT(int)	set_menu_mark (MENU *, const char *);
+extern MENU_EXPORT(int)	set_menu_opts (MENU *,Menu_Options);
+extern MENU_EXPORT(int)	set_menu_pad (MENU *,int);
+extern MENU_EXPORT(int)	set_menu_pattern (MENU *,const char *);
+extern MENU_EXPORT(int)	set_menu_sub (MENU *,WINDOW *);
+extern MENU_EXPORT(int)	set_menu_term (MENU *, Menu_Hook);
+extern MENU_EXPORT(int)	set_menu_userptr (MENU *,void *);
+extern MENU_EXPORT(int)	set_menu_win (MENU *,WINDOW *);
+extern MENU_EXPORT(int)	set_top_row (MENU *,int);
+extern MENU_EXPORT(int)	top_row (const MENU *);
+extern MENU_EXPORT(int)	unpost_menu (MENU *);
+extern MENU_EXPORT(int)	menu_request_by_name (const char *);
+extern MENU_EXPORT(int)	set_menu_spacing (MENU *,int,int,int);
+extern MENU_EXPORT(int)	menu_spacing (const MENU *,int *,int *,int *);
+
+
+extern MENU_EXPORT(bool)	item_value (const ITEM *);
+extern MENU_EXPORT(bool)	item_visible (const ITEM *);
+
+extern MENU_EXPORT(void)	menu_format (const MENU *,int *,int *);
 
 #if NCURSES_SP_FUNCS
-extern NCURSES_EXPORT(MENU *)	NCURSES_SP_NAME(new_menu) (SCREEN*, ITEM **);
+extern MENU_EXPORT(MENU *)	NCURSES_SP_NAME(new_menu) (SCREEN*, ITEM **);
 #endif
 
 #ifdef __cplusplus
diff --git a/menu/menu.priv.h b/menu/menu.priv.h
index d084565a..eb653ba4 100644
--- a/menu/menu.priv.h
+++ b/menu/menu.priv.h
@@ -52,8 +52,8 @@
 /* Backspace code */
 #define BS (8)
 
-extern NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item;
-extern NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu;
+extern MENU_EXPORT_VAR(ITEM) _nc_Default_Item;
+extern MENU_EXPORT_VAR(MENU) _nc_Default_Menu;
 
 /* Normalize item to default if none was given */
 #define Normalize_Item( item ) ((item)=(item)?(item):&_nc_Default_Item)
@@ -120,17 +120,17 @@ extern NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu;
 #define UChar(c)	((unsigned char)(c))
 
 /* Internal functions. */
-extern NCURSES_EXPORT(void) _nc_Draw_Menu (const MENU *);
-extern NCURSES_EXPORT(void) _nc_Show_Menu (const MENU *);
-extern NCURSES_EXPORT(void) _nc_Calculate_Item_Length_and_Width (MENU *);
-extern NCURSES_EXPORT(int)  _nc_Calculate_Text_Width(const TEXT *);
-extern NCURSES_EXPORT(void) _nc_Post_Item (const MENU *, const ITEM *);
-extern NCURSES_EXPORT(bool) _nc_Connect_Items (MENU *, ITEM **);
-extern NCURSES_EXPORT(void) _nc_Disconnect_Items (MENU *);
-extern NCURSES_EXPORT(void) _nc_New_TopRow_and_CurrentItem (MENU *,int, ITEM *);
-extern NCURSES_EXPORT(void) _nc_Link_Items (MENU *);
-extern NCURSES_EXPORT(int)  _nc_Match_Next_Character_In_Item_Name (MENU*,int,ITEM**);
-extern NCURSES_EXPORT(int)  _nc_menu_cursor_pos (const MENU* menu, const ITEM* item,
+extern MENU_EXPORT(void) _nc_Draw_Menu (const MENU *);
+extern MENU_EXPORT(void) _nc_Show_Menu (const MENU *);
+extern MENU_EXPORT(void) _nc_Calculate_Item_Length_and_Width (MENU *);
+extern MENU_EXPORT(int)  _nc_Calculate_Text_Width(const TEXT *);
+extern MENU_EXPORT(void) _nc_Post_Item (const MENU *, const ITEM *);
+extern MENU_EXPORT(bool) _nc_Connect_Items (MENU *, ITEM **);
+extern MENU_EXPORT(void) _nc_Disconnect_Items (MENU *);
+extern MENU_EXPORT(void) _nc_New_TopRow_and_CurrentItem (MENU *,int, ITEM *);
+extern MENU_EXPORT(void) _nc_Link_Items (MENU *);
+extern MENU_EXPORT(int)  _nc_Match_Next_Character_In_Item_Name (MENU*,int,ITEM**);
+extern MENU_EXPORT(int)  _nc_menu_cursor_pos (const MENU* menu, const ITEM* item,
 				int* pY, int* pX);
 
 #ifdef TRACE
@@ -142,12 +142,12 @@ extern NCURSES_EXPORT(int)  _nc_menu_cursor_pos (const MENU* menu, const ITEM* i
 #define returnMenuHook(code)	TRACE_RETURN1(code,menu_hook)
 #define returnMenuOpts(code)	TRACE_RETURN1(code,menu_opts)
 
-extern NCURSES_EXPORT(ITEM *)	    _nc_retrace_item (ITEM *);
-extern NCURSES_EXPORT(ITEM **)	    _nc_retrace_item_ptr (ITEM **);
-extern NCURSES_EXPORT(Item_Options) _nc_retrace_item_opts (Item_Options);
-extern NCURSES_EXPORT(MENU *)	    _nc_retrace_menu (MENU *);
-extern NCURSES_EXPORT(Menu_Hook)    _nc_retrace_menu_hook (Menu_Hook);
-extern NCURSES_EXPORT(Menu_Options) _nc_retrace_menu_opts (Menu_Options);
+extern MENU_EXPORT(ITEM *)	    _nc_retrace_item (ITEM *);
+extern MENU_EXPORT(ITEM **)	    _nc_retrace_item_ptr (ITEM **);
+extern MENU_EXPORT(Item_Options) _nc_retrace_item_opts (Item_Options);
+extern MENU_EXPORT(MENU *)	    _nc_retrace_menu (MENU *);
+extern MENU_EXPORT(Menu_Hook)    _nc_retrace_menu_hook (Menu_Hook);
+extern MENU_EXPORT(Menu_Options) _nc_retrace_menu_opts (Menu_Options);
 
 #else /* !TRACE */
 
diff --git a/panel/p_above.c b/panel/p_above.c
index 12b5b87b..704863a7 100644
--- a/panel/p_above.c
+++ b/panel/p_above.c
@@ -40,7 +40,7 @@
 MODULE_ID("$Id: p_above.c,v 1.10 2020/02/02 23:34:34 tom Exp $")
 
 #if NCURSES_SP_FUNCS
-NCURSES_EXPORT(PANEL *)
+PANEL_EXPORT(PANEL *)
 ground_panel(SCREEN * sp)
 {
   T((T_CALLED("ground_panel(%p)"), (void *)sp));
@@ -63,7 +63,7 @@ ground_panel(SCREEN * sp)
 }
 #endif
 
-NCURSES_EXPORT(PANEL *)
+PANEL_EXPORT(PANEL *)
 panel_above(const PANEL * pan)
 {
   PANEL *result;
diff --git a/panel/p_below.c b/panel/p_below.c
index a8b1ef47..972ec836 100644
--- a/panel/p_below.c
+++ b/panel/p_below.c
@@ -40,7 +40,7 @@
 MODULE_ID("$Id: p_below.c,v 1.10 2020/02/02 23:34:34 tom Exp $")
 
 #if NCURSES_SP_FUNCS
-NCURSES_EXPORT(PANEL *)
+PANEL_EXPORT(PANEL *)
 ceiling_panel(SCREEN * sp)
 {
   T((T_CALLED("ceiling_panel(%p)"), (void *)sp));
@@ -61,7 +61,7 @@ ceiling_panel(SCREEN * sp)
 }
 #endif
 
-NCURSES_EXPORT(PANEL *)
+PANEL_EXPORT(PANEL *)
 panel_below(const PANEL * pan)
 {
   PANEL *result;
diff --git a/panel/p_bottom.c b/panel/p_bottom.c
index a69ac9f4..c4a170ad 100644
--- a/panel/p_bottom.c
+++ b/panel/p_bottom.c
@@ -40,7 +40,7 @@
 
 MODULE_ID("$Id: p_bottom.c,v 1.14 2020/02/02 23:34:34 tom Exp $")
 
-NCURSES_EXPORT(int)
+PANEL_EXPORT(int)
 bottom_panel(PANEL * pan)
 {
   int err = OK;
diff --git a/panel/p_delete.c b/panel/p_delete.c
index 6b122a6c..e58875b1 100644
--- a/panel/p_delete.c
+++ b/panel/p_delete.c
@@ -40,7 +40,7 @@
 
 MODULE_ID("$Id: p_delete.c,v 1.11 2020/02/02 23:34:34 tom Exp $")
 
-NCURSES_EXPORT(int)
+PANEL_EXPORT(int)
 del_panel(PANEL * pan)
 {
   int err = OK;
diff --git a/panel/p_hidden.c b/panel/p_hidden.c
index ddb23b13..a43ea481 100644
--- a/panel/p_hidden.c
+++ b/panel/p_hidden.c
@@ -40,7 +40,7 @@
 
 MODULE_ID("$Id: p_hidden.c,v 1.10 2020/02/02 23:34:34 tom Exp $")
 
-NCURSES_EXPORT(int)
+PANEL_EXPORT(int)
 panel_hidden(const PANEL * pan)
 {
   int rc = ERR;
diff --git a/panel/p_hide.c b/panel/p_hide.c
index fc26f752..35e738e3 100644
--- a/panel/p_hide.c
+++ b/panel/p_hide.c
@@ -39,7 +39,7 @@
 
 MODULE_ID("$Id: p_hide.c,v 1.12 2020/02/02 23:34:34 tom Exp $")
 
-NCURSES_EXPORT(int)
+PANEL_EXPORT(int)
 hide_panel(register PANEL * pan)
 {
   int err = ERR;
diff --git a/panel/p_move.c b/panel/p_move.c
index 02830bf5..77127be7 100644
--- a/panel/p_move.c
+++ b/panel/p_move.c
@@ -40,7 +40,7 @@
 
 MODULE_ID("$Id: p_move.c,v 1.12 2020/02/02 23:34:34 tom Exp $")
 
-NCURSES_EXPORT(int)
+PANEL_EXPORT(int)
 move_panel(PANEL * pan, int starty, int startx)
 {
   int rc = ERR;
diff --git a/panel/p_new.c b/panel/p_new.c
index d2f8d036..659bdeb9 100644
--- a/panel/p_new.c
+++ b/panel/p_new.c
@@ -89,7 +89,7 @@ root_panel(NCURSES_SP_DCL0)
   return _nc_stdscr_pseudo_panel;
 }
 
-NCURSES_EXPORT(PANEL *)
+PANEL_EXPORT(PANEL *)
 new_panel(WINDOW *win)
 {
   PANEL *pan = (PANEL *) 0;
diff --git a/panel/p_replace.c b/panel/p_replace.c
index 5acbccf8..362a2ef8 100644
--- a/panel/p_replace.c
+++ b/panel/p_replace.c
@@ -39,7 +39,7 @@
 
 MODULE_ID("$Id: p_replace.c,v 1.12 2020/02/02 23:34:34 tom Exp $")
 
-NCURSES_EXPORT(int)
+PANEL_EXPORT(int)
 replace_panel(PANEL * pan, WINDOW *win)
 {
   int rc = ERR;
diff --git a/panel/p_show.c b/panel/p_show.c
index 933bf5aa..bfee2cb8 100644
--- a/panel/p_show.c
+++ b/panel/p_show.c
@@ -39,7 +39,7 @@
 
 MODULE_ID("$Id: p_show.c,v 1.14 2020/02/02 23:34:34 tom Exp $")
 
-NCURSES_EXPORT(int)
+PANEL_EXPORT(int)
 show_panel(PANEL * pan)
 {
   int err = ERR;
diff --git a/panel/p_top.c b/panel/p_top.c
index 09e89fcc..438086c1 100644
--- a/panel/p_top.c
+++ b/panel/p_top.c
@@ -39,7 +39,7 @@
 
 MODULE_ID("$Id: p_top.c,v 1.7 2020/02/02 23:34:34 tom Exp $")
 
-NCURSES_EXPORT(int)
+PANEL_EXPORT(int)
 top_panel(PANEL * pan)
 {
   T((T_CALLED("top_panel(%p)"), (void *)pan));
diff --git a/panel/p_update.c b/panel/p_update.c
index 3fe4770b..ca856795 100644
--- a/panel/p_update.c
+++ b/panel/p_update.c
@@ -40,7 +40,7 @@
 
 MODULE_ID("$Id: p_update.c,v 1.12 2020/02/02 23:34:34 tom Exp $")
 
-NCURSES_EXPORT(void)
+PANEL_EXPORT(void)
 NCURSES_SP_NAME(update_panels) (NCURSES_SP_DCL0)
 {
   PANEL *pan;
@@ -71,7 +71,7 @@ NCURSES_SP_NAME(update_panels) (NCURSES_SP_DCL0)
 }
 
 #if NCURSES_SP_FUNCS
-NCURSES_EXPORT(void)
+PANEL_EXPORT(void)
 update_panels(void)
 {
   NCURSES_SP_NAME(update_panels) (CURRENT_SCREEN);
diff --git a/panel/p_user.c b/panel/p_user.c
index 633431ea..e6122d33 100644
--- a/panel/p_user.c
+++ b/panel/p_user.c
@@ -39,7 +39,7 @@
 
 MODULE_ID("$Id: p_user.c,v 1.9 2020/02/02 23:34:34 tom Exp $")
 
-NCURSES_EXPORT(int)
+PANEL_EXPORT(int)
 set_panel_userptr(PANEL * pan, NCURSES_CONST void *uptr)
 {
   T((T_CALLED("set_panel_userptr(%p,%p)"), (void *)pan, (NCURSES_CONST void *)uptr));
@@ -49,7 +49,7 @@ set_panel_userptr(PANEL * pan, NCURSES_CONST void *uptr)
   returnCode(OK);
 }
 
-NCURSES_EXPORT(NCURSES_CONST void *)
+PANEL_EXPORT(NCURSES_CONST void *)
 panel_userptr(const PANEL * pan)
 {
   T((T_CALLED("panel_userptr(%p)"), (const void *)pan));
diff --git a/panel/p_win.c b/panel/p_win.c
index 023a71c9..0bc838f5 100644
--- a/panel/p_win.c
+++ b/panel/p_win.c
@@ -39,7 +39,7 @@
 
 MODULE_ID("$Id: p_win.c,v 1.7 2020/02/02 23:34:34 tom Exp $")
 
-NCURSES_EXPORT(WINDOW *)
+PANEL_EXPORT(WINDOW *)
 panel_window(const PANEL * pan)
 {
   T((T_CALLED("panel_window(%p)"), (const void *)pan));
diff --git a/panel/panel.c b/panel/panel.c
index a0e632d2..5d66476e 100644
--- a/panel/panel.c
+++ b/panel/panel.c
@@ -43,7 +43,7 @@ MODULE_ID("$Id: panel.c,v 1.27 2020/02/02 23:34:34 tom Exp $")
 	_nc_retrace_panel (pan)
 --------------------------------------------------------------------------*/
 #ifdef TRACE
-NCURSES_EXPORT(PANEL *)
+PANEL_EXPORT(PANEL *)
 _nc_retrace_panel(PANEL * pan)
 {
   T((T_RETURN("%p"), (void *)pan));
@@ -56,7 +56,7 @@ _nc_retrace_panel(PANEL * pan)
 --------------------------------------------------------------------------*/
 #ifdef TRACE
 #ifndef TRACE_TXT
-NCURSES_EXPORT(const char *)
+PANEL_EXPORT(const char *)
 _nc_my_visbuf(const void *ptr)
 {
   char temp[32];
@@ -74,7 +74,7 @@ _nc_my_visbuf(const void *ptr)
 	dPanel(text,pan)
 --------------------------------------------------------------------------*/
 #ifdef TRACE
-NCURSES_EXPORT(void)
+PANEL_EXPORT(void)
 _nc_dPanel(const char *text, const PANEL * pan)
 {
   _tracef("%s id=%s b=%s a=%s y=%d x=%d",
@@ -89,7 +89,7 @@ _nc_dPanel(const char *text, const PANEL * pan)
 	dStack(fmt,num,pan)
 --------------------------------------------------------------------------*/
 #ifdef TRACE
-NCURSES_EXPORT(void)
+PANEL_EXPORT(void)
 _nc_dStack(const char *fmt, int num, const PANEL * pan)
 {
   char s80[80];
@@ -115,7 +115,7 @@ _nc_dStack(const char *fmt, int num, const PANEL * pan)
 	Wnoutrefresh(pan) - debugging hook for wnoutrefresh
 --------------------------------------------------------------------------*/
 #ifdef TRACE
-NCURSES_EXPORT(void)
+PANEL_EXPORT(void)
 _nc_Wnoutrefresh(const PANEL * pan)
 {
   dPanel("wnoutrefresh", pan);
@@ -127,7 +127,7 @@ _nc_Wnoutrefresh(const PANEL * pan)
 	Touchpan(pan)
 --------------------------------------------------------------------------*/
 #ifdef TRACE
-NCURSES_EXPORT(void)
+PANEL_EXPORT(void)
 _nc_Touchpan(const PANEL * pan)
 {
   dPanel("Touchpan", pan);
@@ -139,7 +139,7 @@ _nc_Touchpan(const PANEL * pan)
 	Touchline(pan,start,count)
 --------------------------------------------------------------------------*/
 #ifdef TRACE
-NCURSES_EXPORT(void)
+PANEL_EXPORT(void)
 _nc_Touchline(const PANEL * pan, int start, int count)
 {
   char s80[80];
diff --git a/panel/panel.h b/panel/panel.h
index 2eebe178..042cf5d4 100644
--- a/panel/panel.h
+++ b/panel/panel.h
@@ -57,27 +57,40 @@ PANEL;
 extern "C" {
 #endif
 
-extern NCURSES_EXPORT(WINDOW*) panel_window (const PANEL *);
-extern NCURSES_EXPORT(void)    update_panels (void);
-extern NCURSES_EXPORT(int)     hide_panel (PANEL *);
-extern NCURSES_EXPORT(int)     show_panel (PANEL *);
-extern NCURSES_EXPORT(int)     del_panel (PANEL *);
-extern NCURSES_EXPORT(int)     top_panel (PANEL *);
-extern NCURSES_EXPORT(int)     bottom_panel (PANEL *);
-extern NCURSES_EXPORT(PANEL*)  new_panel (WINDOW *);
-extern NCURSES_EXPORT(PANEL*)  panel_above (const PANEL *);
-extern NCURSES_EXPORT(PANEL*)  panel_below (const PANEL *);
-extern NCURSES_EXPORT(int)     set_panel_userptr (PANEL *, NCURSES_CONST void *);
-extern NCURSES_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *);
-extern NCURSES_EXPORT(int)     move_panel (PANEL *, int, int);
-extern NCURSES_EXPORT(int)     replace_panel (PANEL *,WINDOW *);
-extern NCURSES_EXPORT(int)     panel_hidden (const PANEL *);
+#include "ncurses_exports.h"
+
+#if defined(BUILDING_PANEL)
+# define PANEL_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
+#else
+# define PANEL_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
+#endif
+
+#define PANEL_WRAPPED_VAR(type,name) extern PANEL_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
+
+#define PANEL_EXPORT(type) PANEL_IMPEXP type NCURSES_API
+#define PANEL_EXPORT_VAR(type) PANEL_IMPEXP type
+
+extern PANEL_EXPORT(WINDOW*) panel_window (const PANEL *);
+extern PANEL_EXPORT(void)    update_panels (void);
+extern PANEL_EXPORT(int)     hide_panel (PANEL *);
+extern PANEL_EXPORT(int)     show_panel (PANEL *);
+extern PANEL_EXPORT(int)     del_panel (PANEL *);
+extern PANEL_EXPORT(int)     top_panel (PANEL *);
+extern PANEL_EXPORT(int)     bottom_panel (PANEL *);
+extern PANEL_EXPORT(PANEL*)  new_panel (WINDOW *);
+extern PANEL_EXPORT(PANEL*)  panel_above (const PANEL *);
+extern PANEL_EXPORT(PANEL*)  panel_below (const PANEL *);
+extern PANEL_EXPORT(int)     set_panel_userptr (PANEL *, NCURSES_CONST void *);
+extern PANEL_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *);
+extern PANEL_EXPORT(int)     move_panel (PANEL *, int, int);
+extern PANEL_EXPORT(int)     replace_panel (PANEL *,WINDOW *);
+extern PANEL_EXPORT(int)     panel_hidden (const PANEL *);
 
 #if NCURSES_SP_FUNCS
-extern NCURSES_EXPORT(PANEL *) ground_panel(SCREEN *);
-extern NCURSES_EXPORT(PANEL *) ceiling_panel(SCREEN *);
+extern PANEL_EXPORT(PANEL *) ground_panel(SCREEN *);
+extern PANEL_EXPORT(PANEL *) ceiling_panel(SCREEN *);
 
-extern NCURSES_EXPORT(void)    NCURSES_SP_NAME(update_panels) (SCREEN*);
+extern PANEL_EXPORT(void)    NCURSES_SP_NAME(update_panels) (SCREEN*);
 #endif
 
 #if	defined(__cplusplus)
diff --git a/panel/panel.priv.h b/panel/panel.priv.h
index c8e3ea79..bf9df442 100644
--- a/panel/panel.priv.h
+++ b/panel/panel.priv.h
@@ -50,7 +50,7 @@ struct screen;              /* forward declaration */
 #include "panel.h"
 
 #ifdef TRACE
-   extern NCURSES_EXPORT(const char *) _nc_my_visbuf (const void *);
+   extern PANEL_EXPORT(const char *) _nc_my_visbuf (const void *);
 #  ifdef TRACE_TXT
 #    define USER_PTR(ptr) _nc_visbuf((const char *)ptr)
 #  else
@@ -59,12 +59,12 @@ struct screen;              /* forward declaration */
 
 #  define returnPanel(code)	TRACE_RETURN1(code,panel)
 
-   extern NCURSES_EXPORT(PANEL *) _nc_retrace_panel (PANEL *);
-   extern NCURSES_EXPORT(void) _nc_dPanel (const char*, const PANEL*);
-   extern NCURSES_EXPORT(void) _nc_dStack (const char*, int, const PANEL*);
-   extern NCURSES_EXPORT(void) _nc_Wnoutrefresh (const PANEL*);
-   extern NCURSES_EXPORT(void) _nc_Touchpan (const PANEL*);
-   extern NCURSES_EXPORT(void) _nc_Touchline (const PANEL*, int, int);
+   extern PANEL_EXPORT(PANEL *) _nc_retrace_panel (PANEL *);
+   extern PANEL_EXPORT(void) _nc_dPanel (const char*, const PANEL*);
+   extern PANEL_EXPORT(void) _nc_dStack (const char*, int, const PANEL*);
+   extern PANEL_EXPORT(void) _nc_Wnoutrefresh (const PANEL*);
+   extern PANEL_EXPORT(void) _nc_Touchpan (const PANEL*);
+   extern PANEL_EXPORT(void) _nc_Touchline (const PANEL*, int, int);
 
 #  define dBug(x) _tracef x
 #  define dPanel(text,pan) _nc_dPanel(text,pan)
@@ -205,7 +205,7 @@ struct screen;              /* forward declaration */
 
 #if NCURSES_SP_FUNCS
 /* These may become later renamed and part of panel.h and the public API */
-extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_update_panels)(SCREEN*);
+extern PANEL_EXPORT(void) NCURSES_SP_NAME(_nc_update_panels)(SCREEN*);
 #endif
 /* *INDENT-ON* */
 
-- 
2.21.1

