diff -ur ncurses-5.9-orig/c++/Makefile.in ncurses-5.9/c++/Makefile.in
--- ncurses-5.9-orig/c++/Makefile.in	2010-11-27 16:45:27 -0500
+++ ncurses-5.9/c++/Makefile.in	2013-07-04 18:38:36 -0400
@@ -76,7 +76,7 @@
 CXXLIBS		= @CXXLIBS@
 
 INCDIR		= ../include
-CPPFLAGS	= -I../c++ -I$(INCDIR) -I$(srcdir) -DHAVE_CONFIG_H @CPPFLAGS@
+CPPFLAGS	= -I../c++ -I$(INCDIR) -I$(srcdir) -DHAVE_CONFIG_H -DNCURSESXX_DLL @CPPFLAGS@
 
 CTAGS		= @CTAGS@
 ETAGS		= @ETAGS@
@@ -166,7 +166,7 @@
 	$(RANLIB) $@
 
 ../lib/$(LIBNAME_LIBTOOL) : $(LIB_OBJS)
-	cd ../lib && $(LIBTOOL_LINK) $(CXX) $(CXXFLAGS) \
+	cd ../lib && $(LIBTOOL_LINK) $(CXX) -shared $(CXXFLAGS) \
 		-o $(LIBNAME) $(LIB_OBJS:$o=.lo) \
 		-rpath $(INSTALL_PREFIX)$(libdir) \
 		$(LIBTOOL_VERSION) $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(SHLIB_LIST)
@@ -179,7 +179,7 @@
 demo$x:	$(OBJS_DEMO) \
 	$(MY_LIBRARY)  \
 	@TEST_DEPS@
-	@ECHO_LINK@ $(LINK) -o $@ $(OBJS_DEMO) $(LDFLAGS_DEFAULT)
+	@ECHO_LINK@ $(LINK) -o $@ $(OBJS_DEMO) $(LDFLAGS_DEFAULT) -Wl,-subsystem:console
 
 etip.h:	$(srcdir)/etip.h.in $(srcdir)/edit_cfg.sh
 	cp $(srcdir)/etip.h.in $@
@@ -243,6 +243,8 @@
 $(INCDIR)/panel.h :
 	cd ../panel && $(MAKE) $@
 
+../obj_lo/demo$o: CPPFLAGS := $(filter-out -DNCURSESXX_DLL,$(CPPFLAGS))
+
 ###############################################################################
 # The remainder of this file is automatically generated during configuration
 ###############################################################################
diff -ur ncurses-5.9-orig/c++/cursesapp.h ncurses-5.9/c++/cursesapp.h
--- ncurses-5.9-orig/c++/cursesapp.h	2005-05-28 17:57:44 -0400
+++ ncurses-5.9/c++/cursesapp.h	2013-07-04 18:38:36 -0400
@@ -38,7 +38,7 @@
 
 #include <cursslk.h>
 
-class NCURSES_IMPEXP NCursesApplication {
+class NCURSESXX_IMPEXP NCursesApplication {
 public:
   typedef struct _slk_link {          // This structure is used to maintain
     struct _slk_link* prev;           // a stack of SLKs
diff -ur ncurses-5.9-orig/c++/cursesf.h ncurses-5.9/c++/cursesf.h
--- ncurses-5.9-orig/c++/cursesf.h	2005-08-13 14:08:24 -0400
+++ ncurses-5.9/c++/cursesf.h	2013-07-04 18:38:36 -0400
@@ -50,11 +50,11 @@
 // The abstract base class for buitin and user defined Fieldtypes.
 // -------------------------------------------------------------------------
 //
-class NCURSES_IMPEXP NCursesFormField; // forward declaration
+class NCURSESXX_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 NCURSESXX_IMPEXP NCursesFieldType
 {
   friend class NCursesFormField;
 
@@ -100,7 +100,7 @@
 // The class representing a forms field, wrapping the lowlevel FIELD struct
 // -------------------------------------------------------------------------
 //
-class NCURSES_IMPEXP NCursesFormField
+class NCURSESXX_IMPEXP NCursesFormField
 {
   friend class NCursesForm;
 
@@ -337,7 +337,7 @@
 // The class representing a form, wrapping the lowlevel FORM struct
 // -------------------------------------------------------------------------
 //
-class NCURSES_IMPEXP NCursesForm : public NCursesPanel
+class NCURSESXX_IMPEXP NCursesForm : public NCursesPanel
 {
 protected:
   FORM* form;  // the lowlevel structure
@@ -628,7 +628,7 @@
 // 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 NCURSESXX_IMPEXP NCursesUserField : public NCursesFormField
 {
 public:
   NCursesUserField (int rows,
@@ -661,7 +661,7 @@
 // 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 NCURSESXX_IMPEXP NCursesUserForm : public NCursesForm
 {
 protected:
   // 'Internal' constructor, builds an object without association to a
@@ -718,7 +718,7 @@
 // Builtin Fieldtypes
 // -------------------------------------------------------------------------
 //
-class NCURSES_IMPEXP Alpha_Field : public NCursesFieldType
+class NCURSESXX_IMPEXP Alpha_Field : public NCursesFieldType
 {
 private:
   int min_field_width;
@@ -734,7 +734,7 @@
   }
 };
 
-class NCURSES_IMPEXP Alphanumeric_Field : public NCursesFieldType
+class NCURSESXX_IMPEXP Alphanumeric_Field : public NCursesFieldType
 {
 private:
   int min_field_width;
@@ -750,7 +750,7 @@
   }
 };
 
-class NCURSES_IMPEXP Integer_Field : public NCursesFieldType
+class NCURSESXX_IMPEXP Integer_Field : public NCursesFieldType
 {
 private:
   int precision;
@@ -768,7 +768,7 @@
   }
 };
 
-class NCURSES_IMPEXP Numeric_Field : public NCursesFieldType
+class NCURSESXX_IMPEXP Numeric_Field : public NCursesFieldType
 {
 private:
   int precision;
@@ -786,7 +786,7 @@
   }
 };
 
-class NCURSES_IMPEXP Regular_Expression_Field : public NCursesFieldType
+class NCURSESXX_IMPEXP Regular_Expression_Field : public NCursesFieldType
 {
 private:
   char* regex;
@@ -831,7 +831,7 @@
   }
 };
 
-class NCURSES_IMPEXP Enumeration_Field : public NCursesFieldType
+class NCURSESXX_IMPEXP Enumeration_Field : public NCursesFieldType
 {
 private:
   const char** list;
@@ -870,7 +870,7 @@
   }
 };
 
-class NCURSES_IMPEXP IPV4_Address_Field : public NCursesFieldType
+class NCURSESXX_IMPEXP IPV4_Address_Field : public NCursesFieldType
 {
 private:
   void set(NCursesFormField& f) {
@@ -893,7 +893,7 @@
 // Abstract base class for User-Defined Fieldtypes
 // -------------------------------------------------------------------------
 //
-class NCURSES_IMPEXP UserDefinedFieldType : public NCursesFieldType
+class NCURSESXX_IMPEXP UserDefinedFieldType : public NCursesFieldType
 {
   friend class UDF_Init; // Internal helper to set up statics
 private:
@@ -936,7 +936,7 @@
 // Abstract base class for User-Defined Fieldtypes with Choice functions
 // -------------------------------------------------------------------------
 //
-class NCURSES_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType
+class NCURSESXX_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType
 {
   friend class UDF_Init; // Internal helper to set up statics
 private:
diff -ur ncurses-5.9-orig/c++/cursesm.cc ncurses-5.9/c++/cursesm.cc
--- ncurses-5.9-orig/c++/cursesm.cc	2005-04-02 16:39:05 -0400
+++ ncurses-5.9/c++/cursesm.cc	2013-07-04 18:38:58 -0400
@@ -180,8 +180,8 @@
   UserHook* hook = reinterpret_cast<UserHook*>(::menu_userptr(menu));
   delete hook;
   if (b_sub_owner) {
-    delete sub;
     ::set_menu_sub(menu, static_cast<WINDOW *>(0));
+    delete sub;
   }
   if (menu) {
     ITEM** itms = ::menu_items(menu);
diff -ur ncurses-5.9-orig/c++/cursesm.h ncurses-5.9/c++/cursesm.h
--- ncurses-5.9-orig/c++/cursesm.h	2005-08-13 14:10:36 -0400
+++ ncurses-5.9/c++/cursesm.h	2013-07-04 18:38:36 -0400
@@ -46,7 +46,7 @@
 // This wraps the ITEM type of <menu.h>
 // -------------------------------------------------------------------------
 //
-class NCURSES_IMPEXP NCursesMenuItem
+class NCURSESXX_IMPEXP NCursesMenuItem
 {
   friend class NCursesMenu;
 
@@ -151,7 +151,7 @@
 // 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 NCURSESXX_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem
 {
 private:
   ITEMCALLBACK* p_fct;
@@ -198,7 +198,7 @@
 // This wraps the MENU type of <menu.h>
 // -------------------------------------------------------------------------
 //
-class NCURSES_IMPEXP NCursesMenu : public NCursesPanel
+class NCURSESXX_IMPEXP NCursesMenu : public NCursesPanel
 {
 protected:
   MENU *menu;
@@ -594,7 +594,7 @@
 // to create a UserItem.
 // -------------------------------------------------------------------------
 //
-template<class T> class NCURSES_IMPEXP NCursesUserItem : public NCursesMenuItem
+template<class T> class NCursesUserItem : public NCursesMenuItem
 {
 public:
   NCursesUserItem (const char* p_name,
@@ -621,7 +621,7 @@
 // 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 NCursesUserMenu : public NCursesMenu
 {
 protected:
   NCursesUserMenu( int  nlines,
diff -ur ncurses-5.9-orig/c++/cursesp.h ncurses-5.9/c++/cursesp.h
--- ncurses-5.9-orig/c++/cursesp.h	2008-08-16 13:20:23 -0400
+++ ncurses-5.9/c++/cursesp.h	2013-07-04 18:38:36 -0400
@@ -42,7 +42,7 @@
 #  include <panel.h>
 }
 
-class NCURSES_IMPEXP NCursesPanel
+class NCURSESXX_IMPEXP NCursesPanel
   : public NCursesWindow
 {
 protected:
diff -ur ncurses-5.9-orig/c++/cursesw.h ncurses-5.9/c++/cursesw.h
--- ncurses-5.9-orig/c++/cursesw.h	2008-01-19 16:09:10 -0500
+++ ncurses-5.9/c++/cursesw.h	2013-07-04 18:38:36 -0400
@@ -750,7 +750,7 @@
 extern "C" int     _nc_xx_ripoff_init(WINDOW *, int);
 extern "C" int     _nc_has_mouse(void);
 
-class NCURSES_IMPEXP NCursesWindow
+class NCURSESXX_IMPEXP NCursesWindow
 {
   friend class NCursesMenu;
   friend class NCursesForm;
@@ -1364,7 +1364,7 @@
 // -------------------------------------------------------------------------
 // We leave this here for compatibility reasons.
 // -------------------------------------------------------------------------
-class NCURSES_IMPEXP NCursesColorWindow : public NCursesWindow
+class NCURSESXX_IMPEXP NCursesColorWindow : public NCursesWindow
 {
 public:
   NCursesColorWindow(WINDOW* &window)   // useful only for stdscr
@@ -1410,7 +1410,7 @@
 // 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 NCURSESXX_IMPEXP NCursesPad : public NCursesWindow
 {
 private:
   NCursesWindow* viewWin;       // the "viewport" window
@@ -1523,7 +1523,7 @@
 // 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 NCURSESXX_IMPEXP NCursesFramedPad : public NCursesPad
 {
 protected:
   virtual void OnOperation(int pad_req);
diff -ur ncurses-5.9-orig/c++/cursslk.h ncurses-5.9/c++/cursslk.h
--- ncurses-5.9-orig/c++/cursslk.h	2005-05-28 17:58:18 -0400
+++ ncurses-5.9/c++/cursslk.h	2013-07-04 18:38:36 -0400
@@ -38,10 +38,10 @@
 
 #include <cursesw.h>
 
-class NCURSES_IMPEXP Soft_Label_Key_Set {
+class NCURSESXX_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 NCURSESXX_IMPEXP Soft_Label_Key {
     friend class Soft_Label_Key_Set;
   public:
     typedef enum { Left=0, Center=1, Right=2 } Justification;
@@ -100,10 +100,10 @@
   } Label_Layout;
 
 private:
-  static long NCURSES_IMPEXP count;               // Number of Key Sets
-  static Label_Layout NCURSES_IMPEXP  format;     // Layout of the Key Sets
-  static int  NCURSES_IMPEXP num_labels;          // Number Of Labels in Key Sets
-  bool NCURSES_IMPEXP b_attrInit;                 // Are attributes initialized
+  static long count;               // Number of Key Sets
+  static Label_Layout format;     // Layout of the Key Sets
+  static int num_labels;          // Number Of Labels in Key Sets
+  bool b_attrInit;                 // Are attributes initialized
 
   Soft_Label_Key *slk_array;       // The array of SLK's
 
@@ -143,7 +143,7 @@
 
   // This constructor assumes, that you already constructed a Key Set
   // with a layout by the constructor above. This layout will be reused.
-  NCURSES_IMPEXP Soft_Label_Key_Set();
+  Soft_Label_Key_Set();
 
   Soft_Label_Key_Set& operator=(const Soft_Label_Key_Set& rhs)
   {
@@ -164,7 +164,7 @@
   virtual ~Soft_Label_Key_Set();
 
   // Get Label# i. Label counting starts with 1!
-  NCURSES_IMPEXP Soft_Label_Key& operator[](int i);
+  Soft_Label_Key& operator[](int i);
 
   // Retrieve number of Labels
   inline int labels() const { return num_labels; }
diff -ur ncurses-5.9-orig/c++/demo.cc ncurses-5.9/c++/demo.cc
--- ncurses-5.9-orig/c++/demo.cc	2008-12-06 21:07:34 -0500
+++ ncurses-5.9/c++/demo.cc	2013-07-04 18:38:36 -0400
@@ -43,11 +43,11 @@
 #include "cursesm.h"
 #include "cursesf.h"
 
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_MSC_VER)
 #undef KEY_EVENT
 #endif
 
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 extern "C" unsigned int sleep(unsigned int);
 #endif
 
@@ -186,7 +186,7 @@
 };
 
 template class MyAction<UserData>;
-template class NCURSES_IMPEXP NCursesUserItem<UserData>;
+template class NCursesUserItem<UserData>;
 
 class QuitItem : public NCursesMenuItem
 {
diff -ur ncurses-5.9-orig/c++/etip.h.in ncurses-5.9/c++/etip.h.in
--- ncurses-5.9-orig/c++/etip.h.in	2008-08-30 15:27:32 -0400
+++ ncurses-5.9/c++/etip.h.in	2013-07-04 18:38:36 -0400
@@ -139,11 +139,11 @@
 #endif
 
 // Forward Declarations
-class NCURSES_IMPEXP NCursesPanel;
-class NCURSES_IMPEXP NCursesMenu;
-class NCURSES_IMPEXP NCursesForm;
+class NCURSESXX_IMPEXP NCursesPanel;
+class NCURSESXX_IMPEXP NCursesMenu;
+class NCURSESXX_IMPEXP NCursesForm;
 
-class NCURSES_IMPEXP NCursesException
+class NCURSESXX_IMPEXP NCursesException
 {
 public:
   const char *message;
@@ -177,7 +177,7 @@
   }
 };
 
-class NCURSES_IMPEXP NCursesPanelException : public NCursesException
+class NCURSESXX_IMPEXP NCursesPanelException : public NCursesException
 {
 public:
   const NCursesPanel* p;
@@ -228,7 +228,7 @@
   }
 };
 
-class NCURSES_IMPEXP NCursesMenuException : public NCursesException
+class NCURSESXX_IMPEXP NCursesMenuException : public NCursesException
 {
 public:
   const NCursesMenu* m;
@@ -279,7 +279,7 @@
   }
 };
 
-class NCURSES_IMPEXP NCursesFormException : public NCursesException
+class NCURSESXX_IMPEXP NCursesFormException : public NCursesException
 {
 public:
   const NCursesForm* f;
@@ -340,7 +340,9 @@
 #  else
 #     include <iostream.h>
 #  endif
-   extern "C" void exit(int);
+#  ifndef _MSC_VER
+     extern "C" void exit(int);
+#  endif
 #endif
 
 inline void THROW(const NCursesException *e) {
diff -ur ncurses-5.9-orig/c++/internal.h ncurses-5.9/c++/internal.h
--- ncurses-5.9-orig/c++/internal.h	2008-12-06 21:07:34 -0500
+++ ncurses-5.9/c++/internal.h	2013-07-04 18:38:36 -0400
@@ -44,7 +44,7 @@
 #define MODULE_ID(id) /*nothing*/
 #endif
 
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_MSC_VER)
 #include <nc_mingw.h>
 #undef KEY_EVENT
 #endif
diff -ur ncurses-5.9-orig/form/Makefile.in ncurses-5.9/form/Makefile.in
--- ncurses-5.9-orig/form/Makefile.in	2010-11-27 16:45:27 -0500
+++ ncurses-5.9/form/Makefile.in	2013-07-04 18:38:36 -0400
@@ -84,7 +84,7 @@
 CPP		= @CPP@
 CFLAGS		= @CFLAGS@
 
-CPPFLAGS	= -I@top_srcdir@/ncurses -DHAVE_CONFIG_H @CPPFLAGS@
+CPPFLAGS	= -I@top_srcdir@/ncurses -DHAVE_CONFIG_H -DNCFORM_DLL @CPPFLAGS@
 
 CCFLAGS		= $(CPPFLAGS) $(CFLAGS)
 
diff -ur ncurses-5.9-orig/form/f_trace.c ncurses-5.9/form/f_trace.c
--- ncurses-5.9-orig/form/f_trace.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/f_trace.c	2013-07-04 18:38:36 -0400
@@ -34,35 +34,35 @@
 
 MODULE_ID("$Id: f_trace.c,v 1.2 2010/01/23 21:14:36 tom Exp $")
 
-NCURSES_EXPORT(FIELD **)
+NCFORM_EXPORT(FIELD **)
 _nc_retrace_field_ptr(FIELD **code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(FIELD *)
+NCFORM_EXPORT(FIELD *)
 _nc_retrace_field(FIELD *code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(FIELDTYPE *)
+NCFORM_EXPORT(FIELDTYPE *)
 _nc_retrace_field_type(FIELDTYPE *code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(FORM *)
+NCFORM_EXPORT(FORM *)
 _nc_retrace_form(FORM *code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(Form_Hook)
+NCFORM_EXPORT(Form_Hook)
 _nc_retrace_form_hook(Form_Hook code)
 {
   T((T_RETURN("%p"), code));
diff -ur ncurses-5.9-orig/form/fld_arg.c ncurses-5.9/form/fld_arg.c
--- ncurses-5.9-orig/form/fld_arg.c	2010-01-23 16:14:35 -0500
+++ ncurses-5.9/form/fld_arg.c	2013-07-04 18:38:36 -0400
@@ -60,7 +60,7 @@
 |   Return Values :  E_OK           - success
 |                    E_BAD_ARGUMENT - invalid argument
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_fieldtype_arg(FIELDTYPE *typ,
 		  void *(*const make_arg)(va_list *),
 		  void *(*const copy_arg)(const void *),
@@ -88,7 +88,7 @@
 |
 |   Return Values :  Pointer to structure or NULL if none is defined.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void *)
+NCFORM_EXPORT(void *)
 field_arg(const FIELD *field)
 {
   T((T_CALLED("field_arg(%p)"), (const void *)field));
diff -ur ncurses-5.9-orig/form/fld_attr.c ncurses-5.9/form/fld_attr.c
--- ncurses-5.9-orig/form/fld_attr.c	2010-01-23 16:12:08 -0500
+++ ncurses-5.9/form/fld_attr.c	2013-07-04 18:38:37 -0400
@@ -39,7 +39,7 @@
   --------------------------------------------------------------------------*/
 /* "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)\
+NCFORM_IMPEXP int NCFORM_API set_field_ ## name (FIELD * field, chtype attr)\
 {\
    int res = E_BAD_ARGUMENT;\
    T((T_CALLED("set_field_" #name "(%p,%s)"), field, _traceattr(attr)));\
@@ -64,7 +64,7 @@
 
 /* "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)\
+NCFORM_IMPEXP chtype NCFORM_API field_ ## name (const FIELD * field)\
 {\
    T((T_CALLED("field_" #name "(%p)"), (const void *) field));\
    returnAttr( A_ATTRIBUTES & (Normalize_Field( field ) -> name) );\
diff -ur ncurses-5.9-orig/form/fld_current.c ncurses-5.9/form/fld_current.c
--- ncurses-5.9-orig/form/fld_current.c	2010-01-23 16:14:35 -0500
+++ ncurses-5.9/form/fld_current.c	2013-07-04 18:38:37 -0400
@@ -47,7 +47,7 @@
 |                    E_INVALID_FIELD   - current field can't be left
 |                    E_SYSTEM_ERROR    - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_current_field(FORM *form, FIELD *field)
 {
   int err = E_OK;
@@ -110,7 +110,7 @@
 |
 |   Return Values :  Pointer to the current field.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD *)
+NCFORM_EXPORT(FIELD *)
 current_field(const FORM *form)
 {
   T((T_CALLED("current_field(%p)"), (const void *)form));
@@ -127,7 +127,7 @@
 |   Return Values :  >= 0   : field index
 |                    -1     : fieldpointer invalid or field not connected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 field_index(const FIELD *field)
 {
   T((T_CALLED("field_index(%p)"), (const void *)field));
diff -ur ncurses-5.9-orig/form/fld_def.c ncurses-5.9/form/fld_def.c
--- ncurses-5.9-orig/form/fld_def.c	2010-01-23 16:14:35 -0500
+++ ncurses-5.9/form/fld_def.c	2013-07-04 18:38:37 -0400
@@ -65,7 +65,7 @@
   NCURSES_FIELD_EXTENSION
 };
 
-NCURSES_EXPORT_VAR(FIELD *)
+NCFORM_EXPORT_VAR(FIELD *)
 _nc_Default_Field = &default_field;
 
 /*---------------------------------------------------------------------------
@@ -82,7 +82,7 @@
 |   Return Values :  Pointer to argument structure. Maybe NULL.
 |                    In case of an error in *err an error counter is increased.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(TypeArgument *)
+NCFORM_EXPORT(TypeArgument *)
 _nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err)
 {
   TypeArgument *res = (TypeArgument *)0;
@@ -130,7 +130,7 @@
 |   Return Values :  Pointer to argument structure. Maybe NULL.
 |                    In case of an error in *err an error counter is increased.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(TypeArgument *)
+NCFORM_EXPORT(TypeArgument *)
 _nc_Copy_Argument(const FIELDTYPE *typ, const TypeArgument *argp, int *err)
 {
   TypeArgument *res = (TypeArgument *)0;
@@ -179,7 +179,7 @@
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+NCFORM_EXPORT(void)
 _nc_Free_Argument(const FIELDTYPE *typ, TypeArgument *argp)
 {
   if (typ != 0 && (typ->status & _HAS_ARGS) != 0)
@@ -210,7 +210,7 @@
 |   Return Values :  TRUE       - copy worked
 |                    FALSE      - error occurred
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+NCFORM_EXPORT(bool)
 _nc_Copy_Type(FIELD *dst, FIELD const *src)
 {
   int err = 0;
@@ -245,7 +245,7 @@
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+NCFORM_EXPORT(void)
 _nc_Free_Type(FIELD *field)
 {
   assert(field != 0);
@@ -272,7 +272,7 @@
 |
 |   Return Values :  Pointer to the new field or NULL if failure.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD *)
+NCFORM_EXPORT(FIELD *)
 new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf)
 {
   static const FIELD_CELL blank = BLANK;
@@ -352,7 +352,7 @@
 |                    E_BAD_ARGUMENT - invalid field pointer
 |                    E_CONNECTED    - field is connected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 free_field(FIELD *field)
 {
   T((T_CALLED("free_field(%p)"), (void *)field));
diff -ur ncurses-5.9-orig/form/fld_dup.c ncurses-5.9/form/fld_dup.c
--- ncurses-5.9-orig/form/fld_dup.c	2010-01-23 16:14:35 -0500
+++ ncurses-5.9/form/fld_dup.c	2013-07-04 18:38:37 -0400
@@ -47,7 +47,7 @@
 |
 |   Return Values :  Pointer to the new field or NULL if failure
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD *)
+NCFORM_EXPORT(FIELD *)
 dup_field(FIELD *field, int frow, int fcol)
 {
   FIELD *New_Field = (FIELD *)0;
diff -ur ncurses-5.9-orig/form/fld_ftchoice.c ncurses-5.9/form/fld_ftchoice.c
--- ncurses-5.9-orig/form/fld_ftchoice.c	2010-01-23 16:14:35 -0500
+++ ncurses-5.9/form/fld_ftchoice.c	2013-07-04 18:38:37 -0400
@@ -46,7 +46,7 @@
 |   Return Values :  E_OK           - success
 |                    E_BAD_ARGUMENT - invalid arguments
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_fieldtype_choice(FIELDTYPE *typ,
 		     bool (*const next_choice) (FIELD *, const void *),
 		     bool (*const prev_choice) (FIELD *, const void *))
diff -ur ncurses-5.9-orig/form/fld_ftlink.c ncurses-5.9/form/fld_ftlink.c
--- ncurses-5.9-orig/form/fld_ftlink.c	2010-01-23 16:14:35 -0500
+++ ncurses-5.9/form/fld_ftlink.c	2013-07-04 18:38:37 -0400
@@ -48,7 +48,7 @@
 |
 |   Return Values :  Fieldtype pointer or NULL if error occurred.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELDTYPE *)
+NCFORM_EXPORT(FIELDTYPE *)
 link_fieldtype(FIELDTYPE *type1, FIELDTYPE *type2)
 {
   FIELDTYPE *nftyp = (FIELDTYPE *)0;
diff -ur ncurses-5.9-orig/form/fld_info.c ncurses-5.9/form/fld_info.c
--- ncurses-5.9-orig/form/fld_info.c	2010-01-23 16:14:35 -0500
+++ ncurses-5.9/form/fld_info.c	2013-07-04 18:38:37 -0400
@@ -46,7 +46,7 @@
 |   Return Values :  E_OK           - success
 |                    E_BAD_ARGUMENT - invalid field pointer
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 field_info(const FIELD *field,
 	   int *rows, int *cols,
 	   int *frow, int *fcol,
@@ -88,7 +88,7 @@
 |   Return Values :  E_OK           - success
 |                    E_BAD_ARGUMENT - invalid argument
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_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 -ur ncurses-5.9-orig/form/fld_just.c ncurses-5.9/form/fld_just.c
--- ncurses-5.9-orig/form/fld_just.c	2010-01-23 16:14:35 -0500
+++ ncurses-5.9/form/fld_just.c	2013-07-04 18:38:37 -0400
@@ -44,7 +44,7 @@
 |                    E_BAD_ARGUMENT  - one of the arguments was incorrect
 |                    E_SYSTEM_ERROR  - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_field_just(FIELD *field, int just)
 {
   int res = E_BAD_ARGUMENT;
@@ -76,7 +76,7 @@
 |
 |   Return Values :  The justification type.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 field_just(const FIELD *field)
 {
   T((T_CALLED("field_just(%p)"), (const void *)field));
diff -ur ncurses-5.9-orig/form/fld_link.c ncurses-5.9/form/fld_link.c
--- ncurses-5.9-orig/form/fld_link.c	2010-01-23 16:14:35 -0500
+++ ncurses-5.9/form/fld_link.c	2013-07-04 18:38:37 -0400
@@ -48,7 +48,7 @@
 |
 |   Return Values :  Pointer to the new field or NULL if failure
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD *)
+NCFORM_EXPORT(FIELD *)
 link_field(FIELD *field, int frow, int fcol)
 {
   FIELD *New_Field = (FIELD *)0;
diff -ur ncurses-5.9-orig/form/fld_max.c ncurses-5.9/form/fld_max.c
--- ncurses-5.9-orig/form/fld_max.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/fld_max.c	2013-07-04 18:38:37 -0400
@@ -44,7 +44,7 @@
 |   Return Values :  E_OK           - success
 |                    E_BAD_ARGUMENT - invalid argument
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_max_field(FIELD *field, int maxgrow)
 {
   T((T_CALLED("set_max_field(%p,%d)"), (void *)field, maxgrow));
diff -ur ncurses-5.9-orig/form/fld_move.c ncurses-5.9/form/fld_move.c
--- ncurses-5.9-orig/form/fld_move.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/fld_move.c	2013-07-04 18:38:37 -0400
@@ -45,7 +45,7 @@
 |                    E_BAD_ARGUMENT  - invalid argument passed
 |                    E_CONNECTED     - field is connected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 move_field(FIELD *field, int frow, int fcol)
 {
   T((T_CALLED("move_field(%p,%d,%d)"), (void *)field, frow, fcol));
diff -ur ncurses-5.9-orig/form/fld_newftyp.c ncurses-5.9/form/fld_newftyp.c
--- ncurses-5.9-orig/form/fld_newftyp.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/fld_newftyp.c	2013-07-04 18:38:37 -0400
@@ -52,7 +52,7 @@
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE *)
+NCFORM_EXPORT_VAR(FIELDTYPE *)
 _nc_Default_FieldType = &default_fieldtype;
 
 /*---------------------------------------------------------------------------
@@ -70,7 +70,7 @@
 |
 |   Return Values :  Fieldtype pointer or NULL if error occurred
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELDTYPE *)
+NCFORM_EXPORT(FIELDTYPE *)
 new_fieldtype(bool (*const field_check) (FIELD *, const void *),
 	      bool (*const char_check) (int, const void *))
 {
@@ -115,7 +115,7 @@
 |                    E_CONNECTED     - there are fields referencing the type
 |                    E_BAD_ARGUMENT  - invalid fieldtype pointer
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 free_fieldtype(FIELDTYPE *typ)
 {
   T((T_CALLED("free_fieldtype(%p)"), (void *)typ));
diff -ur ncurses-5.9-orig/form/fld_opts.c ncurses-5.9/form/fld_opts.c
--- ncurses-5.9-orig/form/fld_opts.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/fld_opts.c	2013-07-04 18:38:37 -0400
@@ -50,7 +50,7 @@
 |                    E_BAD_ARGUMENT  - invalid options
 |                    E_SYSTEM_ERROR  - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_field_opts(FIELD *field, Field_Options opts)
 {
   int res = E_BAD_ARGUMENT;
@@ -71,7 +71,7 @@
 |
 |   Return Values :  The options.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(Field_Options)
+NCFORM_EXPORT(Field_Options)
 field_opts(const FIELD *field)
 {
   T((T_CALLED("field_opts(%p)"), (const void *)field));
@@ -91,7 +91,7 @@
 |                    E_BAD_ARGUMENT  - invalid options
 |                    E_SYSTEM_ERROR  - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 field_opts_on(FIELD *field, Field_Options opts)
 {
   int res = E_BAD_ARGUMENT;
@@ -119,7 +119,7 @@
 |                    E_BAD_ARGUMENT  - invalid options
 |                    E_SYSTEM_ERROR  - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 field_opts_off(FIELD *field, Field_Options opts)
 {
   int res = E_BAD_ARGUMENT;
diff -ur ncurses-5.9-orig/form/fld_pad.c ncurses-5.9/form/fld_pad.c
--- ncurses-5.9-orig/form/fld_pad.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/fld_pad.c	2013-07-04 18:38:37 -0400
@@ -45,7 +45,7 @@
 |                    E_BAD_ARGUMENT - invalid field pointer or pad character
 |                    E_SYSTEM_ERROR - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_field_pad(FIELD *field, int ch)
 {
   int res = E_BAD_ARGUMENT;
@@ -74,7 +74,7 @@
 |
 |   Return Values :  The pad character.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 field_pad(const FIELD *field)
 {
   T((T_CALLED("field_pad(%p)"), (const void *)field));
diff -ur ncurses-5.9-orig/form/fld_page.c ncurses-5.9/form/fld_page.c
--- ncurses-5.9-orig/form/fld_page.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/fld_page.c	2013-07-04 18:38:37 -0400
@@ -44,7 +44,7 @@
 |   Return Values :  E_OK         - success
 |                    E_CONNECTED  - field is connected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_new_page(FIELD *field, bool new_page_flag)
 {
   T((T_CALLED("set_new_page(%p,%d)"), (void *)field, new_page_flag));
@@ -71,7 +71,7 @@
 |   Return Values :  TRUE  - field starts a new page
 |                    FALSE - field doesn't start a new page
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+NCFORM_EXPORT(bool)
 new_page(const FIELD *field)
 {
   T((T_CALLED("new_page(%p)"), (const void *)field));
diff -ur ncurses-5.9-orig/form/fld_stat.c ncurses-5.9/form/fld_stat.c
--- ncurses-5.9-orig/form/fld_stat.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/fld_stat.c	2013-07-04 18:38:37 -0400
@@ -43,7 +43,7 @@
 |
 |   Return Values :  E_OK            - success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_field_status(FIELD *field, bool status)
 {
   T((T_CALLED("set_field_status(%p,%d)"), (void *)field, status));
@@ -68,7 +68,7 @@
 |   Return Values :  TRUE  - buffer has been changed
 |                    FALSE - buffer has not been changed
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+NCFORM_EXPORT(bool)
 field_status(const FIELD *field)
 {
   T((T_CALLED("field_status(%p)"), (const void *)field));
diff -ur ncurses-5.9-orig/form/fld_type.c ncurses-5.9/form/fld_type.c
--- ncurses-5.9-orig/form/fld_type.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/fld_type.c	2013-07-04 18:38:37 -0400
@@ -45,7 +45,7 @@
 |   Return Values :  E_OK           - success
 |                    E_SYSTEM_ERROR - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_field_type(FIELD *field, FIELDTYPE *type,...)
 {
   va_list ap;
@@ -87,7 +87,7 @@
 |
 |   Return Values :  Pointer to fieldtype of NULL if none is defined.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELDTYPE *)
+NCFORM_EXPORT(FIELDTYPE *)
 field_type(const FIELD *field)
 {
   T((T_CALLED("field_type(%p)"), (const void *)field));
diff -ur ncurses-5.9-orig/form/fld_user.c ncurses-5.9/form/fld_user.c
--- ncurses-5.9-orig/form/fld_user.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/fld_user.c	2013-07-04 18:38:37 -0400
@@ -43,7 +43,7 @@
 |
 |   Return Values :  E_OK         - on success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_field_userptr(FIELD *field, void *usrptr)
 {
   T((T_CALLED("set_field_userptr(%p,%p)"), (void *)field, (void *)usrptr));
@@ -62,7 +62,7 @@
 |   Return Values :  Value of pointer. If no such pointer has been set,
 |                    NULL is returned
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void *)
+NCFORM_EXPORT(void *)
 field_userptr(const FIELD *field)
 {
   T((T_CALLED("field_userptr(%p)"), (const void *)field));
diff -ur ncurses-5.9-orig/form/form.h ncurses-5.9/form/form.h
--- ncurses-5.9-orig/form/form.h	2009-11-07 14:31:11 -0500
+++ ncurses-5.9/form/form.h	2013-07-04 18:38:37 -0400
@@ -287,132 +287,132 @@
 	/*************************
 	*  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 NCFORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA;
+extern NCFORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM;
+extern NCFORM_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM;
+extern NCFORM_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER;
+extern NCFORM_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC;
+extern NCFORM_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 NCFORM_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4;      /* Internet IP Version 4 address */
 
 	/***********************
 	*  FIELDTYPE routines  *
 	***********************/
-extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype (
+extern NCFORM_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 NCFORM_EXPORT(FIELDTYPE *) link_fieldtype(
 		    FIELDTYPE *, FIELDTYPE *);
 
-extern NCURSES_EXPORT(int)	free_fieldtype (FIELDTYPE *);
-extern NCURSES_EXPORT(int)	set_fieldtype_arg (FIELDTYPE *,
+extern NCFORM_EXPORT(int)	free_fieldtype (FIELDTYPE *);
+extern NCFORM_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 NCFORM_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 NCFORM_EXPORT(FIELD *)	new_field (int,int,int,int,int,int);
+extern NCFORM_EXPORT(FIELD *)	dup_field (FIELD *,int,int);
+extern NCFORM_EXPORT(FIELD *)	link_field (FIELD *,int,int);
+
+extern NCFORM_EXPORT(int)	free_field (FIELD *);
+extern NCFORM_EXPORT(int)	field_info (const FIELD *,int *,int *,int *,int *,int *,int *);
+extern NCFORM_EXPORT(int)	dynamic_field_info (const FIELD *,int *,int *,int *);
+extern NCFORM_EXPORT(int)	set_max_field ( FIELD *,int);
+extern NCFORM_EXPORT(int)	move_field (FIELD *,int,int);
+extern NCFORM_EXPORT(int)	set_field_type (FIELD *,FIELDTYPE *,...);
+extern NCFORM_EXPORT(int)	set_new_page (FIELD *,bool);
+extern NCFORM_EXPORT(int)	set_field_just (FIELD *,int);
+extern NCFORM_EXPORT(int)	field_just (const FIELD *);
+extern NCFORM_EXPORT(int)	set_field_fore (FIELD *,chtype);
+extern NCFORM_EXPORT(int)	set_field_back (FIELD *,chtype);
+extern NCFORM_EXPORT(int)	set_field_pad (FIELD *,int);
+extern NCFORM_EXPORT(int)	field_pad (const FIELD *);
+extern NCFORM_EXPORT(int)	set_field_buffer (FIELD *,int,const char *);
+extern NCFORM_EXPORT(int)	set_field_status (FIELD *,bool);
+extern NCFORM_EXPORT(int)	set_field_userptr (FIELD *, void *);
+extern NCFORM_EXPORT(int)	set_field_opts (FIELD *,Field_Options);
+extern NCFORM_EXPORT(int)	field_opts_on (FIELD *,Field_Options);
+extern NCFORM_EXPORT(int)	field_opts_off (FIELD *,Field_Options);
+
+extern NCFORM_EXPORT(chtype)	field_fore (const FIELD *);
+extern NCFORM_EXPORT(chtype)	field_back (const FIELD *);
+
+extern NCFORM_EXPORT(bool)	new_page (const FIELD *);
+extern NCFORM_EXPORT(bool)	field_status (const FIELD *);
+
+extern NCFORM_EXPORT(void *)	field_arg (const FIELD *);
 
-extern NCURSES_EXPORT(void *)	field_userptr (const FIELD *);
+extern NCFORM_EXPORT(void *)	field_userptr (const FIELD *);
 
-extern NCURSES_EXPORT(FIELDTYPE *)	field_type (const FIELD *);
+extern NCFORM_EXPORT(FIELDTYPE *)	field_type (const FIELD *);
 
-extern NCURSES_EXPORT(char *)	field_buffer (const FIELD *,int);
+extern NCFORM_EXPORT(char *)	field_buffer (const FIELD *,int);
 
-extern NCURSES_EXPORT(Field_Options)	field_opts (const FIELD *);
+extern NCFORM_EXPORT(Field_Options)	field_opts (const FIELD *);
 
 	/******************
 	*  FORM routines  *
 	******************/
 
-extern NCURSES_EXPORT(FORM *)	new_form (FIELD **);
+extern NCFORM_EXPORT(FORM *)	new_form (FIELD **);
 
-extern NCURSES_EXPORT(FIELD **)	form_fields (const FORM *);
-extern NCURSES_EXPORT(FIELD *)	current_field (const FORM *);
+extern NCFORM_EXPORT(FIELD **)	form_fields (const FORM *);
+extern NCFORM_EXPORT(FIELD *)	current_field (const FORM *);
 
-extern NCURSES_EXPORT(WINDOW *)	form_win (const FORM *);
-extern NCURSES_EXPORT(WINDOW *)	form_sub (const FORM *);
+extern NCFORM_EXPORT(WINDOW *)	form_win (const FORM *);
+extern NCFORM_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)	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 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 NCFORM_EXPORT(Form_Hook)	form_init (const FORM *);
+extern NCFORM_EXPORT(Form_Hook)	form_term (const FORM *);
+extern NCFORM_EXPORT(Form_Hook)	field_init (const FORM *);
+extern NCFORM_EXPORT(Form_Hook)	field_term (const FORM *);
+
+extern NCFORM_EXPORT(int)	free_form (FORM *);
+extern NCFORM_EXPORT(int)	set_form_fields (FORM *,FIELD **);
+extern NCFORM_EXPORT(int)	field_count (const FORM *);
+extern NCFORM_EXPORT(int)	set_form_win (FORM *,WINDOW *);
+extern NCFORM_EXPORT(int)	set_form_sub (FORM *,WINDOW *);
+extern NCFORM_EXPORT(int)	set_current_field (FORM *,FIELD *);
+extern NCFORM_EXPORT(int)	field_index (const FIELD *);
+extern NCFORM_EXPORT(int)	set_form_page (FORM *,int);
+extern NCFORM_EXPORT(int)	form_page (const FORM *);
+extern NCFORM_EXPORT(int)	scale_form (const FORM *,int *,int *);
+extern NCFORM_EXPORT(int)	set_form_init (FORM *,Form_Hook);
+extern NCFORM_EXPORT(int)	set_form_term (FORM *,Form_Hook);
+extern NCFORM_EXPORT(int)	set_field_init (FORM *,Form_Hook);
+extern NCFORM_EXPORT(int)	set_field_term (FORM *,Form_Hook);
+extern NCFORM_EXPORT(int)	post_form (FORM *);
+extern NCFORM_EXPORT(int)	unpost_form (FORM *);
+extern NCFORM_EXPORT(int)	pos_form_cursor (FORM *);
+extern NCFORM_EXPORT(int)	form_driver (FORM *,int);
+extern NCFORM_EXPORT(int)	set_form_userptr (FORM *,void *);
+extern NCFORM_EXPORT(int)	set_form_opts (FORM *,Form_Options);
+extern NCFORM_EXPORT(int)	form_opts_on (FORM *,Form_Options);
+extern NCFORM_EXPORT(int)	form_opts_off (FORM *,Form_Options);
+extern NCFORM_EXPORT(int)	form_request_by_name (const char *);
 
-extern NCURSES_EXPORT(const char *)	form_request_name (int);
+extern NCFORM_EXPORT(const char *)	form_request_name (int);
 
-extern NCURSES_EXPORT(void *)	form_userptr (const FORM *);
+extern NCFORM_EXPORT(void *)	form_userptr (const FORM *);
 
-extern NCURSES_EXPORT(Form_Options)	form_opts (const FORM *);
+extern NCFORM_EXPORT(Form_Options)	form_opts (const FORM *);
 
-extern NCURSES_EXPORT(bool)	data_ahead (const FORM *);
-extern NCURSES_EXPORT(bool)	data_behind (const FORM *);
+extern NCFORM_EXPORT(bool)	data_ahead (const FORM *);
+extern NCFORM_EXPORT(bool)	data_behind (const FORM *);
 
 #if NCURSES_SP_FUNCS
-extern NCURSES_EXPORT(FORM *)	NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
+extern NCFORM_EXPORT(FORM *)	NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
 #endif
 
 #ifdef __cplusplus
diff -ur ncurses-5.9-orig/form/form.priv.h ncurses-5.9/form/form.priv.h
--- ncurses-5.9-orig/form/form.priv.h	2009-11-07 16:26:43 -0500
+++ ncurses-5.9/form/form.priv.h	2013-07-04 18:38:37 -0400
@@ -65,9 +65,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 NCFORM_EXPORT_VAR(FORM *)      _nc_Default_Form;
+extern NCFORM_EXPORT_VAR(FIELD *)     _nc_Default_Field;
+extern NCFORM_EXPORT_VAR(FIELDTYPE *) _nc_Default_FieldType;
 
 /* form  status values */
 #define _OVLMODE         (0x04U) /* Form is in overlay mode                */
@@ -163,31 +163,31 @@
 
 #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 NCFORM_EXPORT(TypeArgument *) _nc_Make_Argument (const FIELDTYPE*, va_list*, int*);
+extern NCFORM_EXPORT(TypeArgument *) _nc_Copy_Argument (const FIELDTYPE*, const TypeArgument*, int*);
+extern NCFORM_EXPORT(void) _nc_Free_Argument (const FIELDTYPE*, TypeArgument*);
+extern NCFORM_EXPORT(bool) _nc_Copy_Type (FIELD*, FIELD const *);
+extern NCFORM_EXPORT(void) _nc_Free_Type (FIELD *);
+
+extern NCFORM_EXPORT(int) _nc_Synchronize_Attributes (FIELD*);
+extern NCFORM_EXPORT(int) _nc_Synchronize_Options (FIELD*, Field_Options);
+extern NCFORM_EXPORT(int) _nc_Set_Form_Page (FORM*, int, FIELD*);
+extern NCFORM_EXPORT(int) _nc_Refresh_Current_Field (FORM*);
+extern NCFORM_EXPORT(FIELD *) _nc_First_Active_Field (FORM*);
+extern NCFORM_EXPORT(bool) _nc_Internal_Validation (FORM*);
+extern NCFORM_EXPORT(int) _nc_Set_Current_Field (FORM*, FIELD*);
+extern NCFORM_EXPORT(int) _nc_Position_Form_Cursor (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 NCFORM_EXPORT(FIELDTYPE *) _nc_TYPE_INTEGER(void);
+extern NCFORM_EXPORT(FIELDTYPE *) _nc_TYPE_ALNUM(void);
+extern NCFORM_EXPORT(FIELDTYPE *) _nc_TYPE_ALPHA(void);
+extern NCFORM_EXPORT(FIELDTYPE *) _nc_TYPE_ENUM(void);
+extern NCFORM_EXPORT(FIELDTYPE *) _nc_TYPE_NUMERIC(void);
+extern NCFORM_EXPORT(FIELDTYPE *) _nc_TYPE_REGEXP(void);
+extern NCFORM_EXPORT(FIELDTYPE *) _nc_TYPE_IPV4(void);
 
-extern NCURSES_EXPORT(FIELDTYPE *)
+extern NCFORM_EXPORT(FIELDTYPE *)
 _nc_generic_fieldtype(bool (*const field_check) (FORM*, 
 						 FIELD *, 
 						 const void *),
@@ -198,18 +198,18 @@
 		      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 NCFORM_EXPORT(int) _nc_set_generic_fieldtype(FIELD*, FIELDTYPE*, int (*)(void**));
+extern NCFORM_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 NCFORM_EXPORT(void) _nc_get_fieldbuffer(FORM*, FIELD*, FIELD_CELL*);
 
 #if USE_WIDEC_SUPPORT
-extern NCURSES_EXPORT(wchar_t *) _nc_Widen_String(char *, int *);
+extern NCFORM_EXPORT(wchar_t *) _nc_Widen_String(char *, int *);
 #endif
 
 #ifdef TRACE
@@ -220,11 +220,11 @@
 #define returnFieldType(code)	TRACE_RETURN(code,field_type)
 #define returnFormHook(code)	TRACE_RETURN(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 NCFORM_EXPORT(FIELD **)	    _nc_retrace_field_ptr (FIELD **);
+extern NCFORM_EXPORT(FIELD *)	    _nc_retrace_field (FIELD *);
+extern NCFORM_EXPORT(FIELDTYPE *)  _nc_retrace_field_type (FIELDTYPE *);
+extern NCFORM_EXPORT(FORM *)       _nc_retrace_form (FORM *);
+extern NCFORM_EXPORT(Form_Hook)    _nc_retrace_form_hook (Form_Hook);
 
 #else /* !TRACE */
 
diff -ur ncurses-5.9-orig/form/frm_cursor.c ncurses-5.9/form/frm_cursor.c
--- ncurses-5.9-orig/form/frm_cursor.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/frm_cursor.c	2013-07-04 18:38:37 -0400
@@ -48,7 +48,7 @@
 |                    E_BAD_ARGUMENT            - Invalid form pointer
 |                    E_NOT_POSTED              - Form is not posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 pos_form_cursor(FORM *form)
 {
   int res;
diff -ur ncurses-5.9-orig/form/frm_data.c ncurses-5.9/form/frm_data.c
--- ncurses-5.9-orig/form/frm_data.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/frm_data.c	2013-07-04 18:38:37 -0400
@@ -44,7 +44,7 @@
 |   Return Values :  TRUE   - there are off-screen data behind
 |                    FALSE  - there are no off-screen data behind
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+NCFORM_EXPORT(bool)
 data_behind(const FORM *form)
 {
   bool result = FALSE;
@@ -131,7 +131,7 @@
 |   Return Values :  TRUE   - there are off-screen data ahead
 |                    FALSE  - there are no off-screen data ahead
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+NCFORM_EXPORT(bool)
 data_ahead(const FORM *form)
 {
   bool result = FALSE;
diff -ur ncurses-5.9-orig/form/frm_def.c ncurses-5.9/form/frm_def.c
--- ncurses-5.9-orig/form/frm_def.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/frm_def.c	2013-07-04 18:38:37 -0400
@@ -61,7 +61,7 @@
   NULL				/* fieldterm  */
 };
 
-NCURSES_EXPORT_VAR(FORM *) _nc_Default_Form = &default_form;
+NCFORM_EXPORT_VAR(FORM *) _nc_Default_Form = &default_form;
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -294,7 +294,7 @@
 |                    E_CONNECTED     - a field is already connected
 |                    E_SYSTEM_ERROR  - not enough memory
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FORM *)
+NCFORM_EXPORT(FORM *)
 NCURSES_SP_NAME(new_form) (NCURSES_SP_DCLx FIELD **fields)
 {
   int err = E_SYSTEM_ERROR;
@@ -343,7 +343,7 @@
 |                    E_SYSTEM_ERROR  - not enough memory
 +--------------------------------------------------------------------------*/
 #if NCURSES_SP_FUNCS
-NCURSES_EXPORT(FORM *)
+NCFORM_EXPORT(FORM *)
 new_form(FIELD **fields)
 {
   return NCURSES_SP_NAME(new_form) (CURRENT_SCREEN, fields);
@@ -360,7 +360,7 @@
 |                    E_BAD_ARGUMENT - invalid form pointer
 |                    E_POSTED       - form is posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 free_form(FORM *form)
 {
   T((T_CALLED("free_form(%p)"), (void *)form));
@@ -391,7 +391,7 @@
 |                    E_POSTED        - form is posted
 |                    E_SYSTEM_ERROR  - not enough memory
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_form_fields(FORM *form, FIELD **fields)
 {
   FIELD **old;
@@ -422,7 +422,7 @@
 |
 |   Return Values :  Pointer to field array
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD **)
+NCFORM_EXPORT(FIELD **)
 form_fields(const FORM *form)
 {
   T((T_CALLED("form_field(%p)"), (const void *)form));
@@ -437,7 +437,7 @@
 |
 |   Return Values :  Number of fields, -1 if none are defined
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 field_count(const FORM *form)
 {
   T((T_CALLED("field_count(%p)"), (const void *)form));
diff -ur ncurses-5.9-orig/form/frm_driver.c ncurses-5.9/form/frm_driver.c
--- ncurses-5.9-orig/form/frm_driver.c	2010-05-01 17:11:43 -0400
+++ ncurses-5.9/form/frm_driver.c	2013-07-04 18:38:37 -0400
@@ -524,7 +524,7 @@
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+NCFORM_EXPORT(void)
 _nc_get_fieldbuffer(FORM *form, FIELD *field, FIELD_CELL *buf)
 {
   int pad;
@@ -802,7 +802,7 @@
 |                    E_SYSTEM_ERROR    - form has no current field or
 |                                        field-window
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 _nc_Position_Form_Cursor(FORM *form)
 {
   FIELD *field;
@@ -843,7 +843,7 @@
 |                    E_BAD_ARGUMENT    - invalid form pointer
 |                    E_SYSTEM_ERROR    - general error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 _nc_Refresh_Current_Field(FORM *form)
 {
   WINDOW *formwin;
@@ -1233,7 +1233,7 @@
 |                    E_BAD_ARGUMENT   - invalid field pointer
 |                    E_SYSTEM_ERROR   - some severe basic error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 _nc_Synchronize_Attributes(FIELD *field)
 {
   FORM *form;
@@ -1299,7 +1299,7 @@
 |                    E_CURRENT           - field is the current one
 |                    E_SYSTEM_ERROR      - some severe basic error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 _nc_Synchronize_Options(FIELD *field, Field_Options newopts)
 {
   Field_Options oldopts;
@@ -1401,7 +1401,7 @@
 |                    E_SYSTEM_ERROR    - some severe basic error
 |                    E_NOT_CONNECTED   - no fields are connected to the form
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 _nc_Set_Current_Field(FORM *form, FIELD *newfield)
 {
   FIELD *field;
@@ -3159,7 +3159,7 @@
 |   Return Values :  TRUE  - field is valid
 |                    FALSE - field is invalid
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+NCFORM_EXPORT(bool)
 _nc_Internal_Validation(FORM *form)
 {
   FIELD *field;
@@ -3253,7 +3253,7 @@
 |
 |   Return Values :  Pointer to calculated field.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD *)
+NCFORM_EXPORT(FIELD *)
 _nc_First_Active_Field(FORM *form)
 {
   FIELD **last_on_page = &form->field[form->page[form->curpage].pmax];
@@ -3806,7 +3806,7 @@
 |                    E_BAD_ARGUMENT      - invalid field pointer
 |                    E_SYSTEM_ERROR      - some severe basic error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 _nc_Set_Form_Page(FORM *form, int page, FIELD *field)
 {
   int res = E_OK;
@@ -4193,7 +4193,7 @@
 |                    E_NOT_CONNECTED   - no fields are connected to the form
 |                    E_UNKNOWN_COMMAND - command not known
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 form_driver(FORM *form, int c)
 {
   const Binding_Info *BI = (Binding_Info *) 0;
@@ -4384,7 +4384,7 @@
 |                    E_BAD_ARGUMENT  - invalid argument
 |                    E_SYSTEM_ERROR  - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_field_buffer(FIELD *field, int buffer, const char *value)
 {
   FIELD_CELL *p;
@@ -4501,7 +4501,7 @@
 |
 |   Return Values :  Pointer to buffer or NULL if arguments were invalid.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(char *)
+NCFORM_EXPORT(char *)
 field_buffer(const FIELD *field, int buffer)
 {
   char *result = 0;
@@ -4569,7 +4569,7 @@
 | Convert a multibyte string to a wide-character string.  The result must be
 | freed by the caller.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(wchar_t *)
+NCFORM_EXPORT(wchar_t *)
 _nc_Widen_String(char *source, int *lengthp)
 {
   wchar_t *result = 0;
diff -ur ncurses-5.9-orig/form/frm_hook.c ncurses-5.9/form/frm_hook.c
--- ncurses-5.9-orig/form/frm_hook.c	2010-01-23 16:12:08 -0500
+++ ncurses-5.9/form/frm_hook.c	2013-07-04 18:38:37 -0400
@@ -36,7 +36,7 @@
 
 /* "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)\
+NCFORM_IMPEXP int NCFORM_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\
 {\
    T((T_CALLED("set_" #typ"_"#name"(%p,%p)"), form, func));\
    (Normalize_Form( form ) -> typ ## name) = func ;\
@@ -45,7 +45,7 @@
 
 /* "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 )\
+NCFORM_IMPEXP Form_Hook NCFORM_API typ ## _ ## name ( const FORM *form )\
 {\
    T((T_CALLED(#typ "_" #name "(%p)"), (const void *) form));\
    returnFormHook( Normalize_Form( form ) -> typ ## name );\
diff -ur ncurses-5.9-orig/form/frm_opts.c ncurses-5.9/form/frm_opts.c
--- ncurses-5.9-orig/form/frm_opts.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/frm_opts.c	2013-07-04 18:38:37 -0400
@@ -44,7 +44,7 @@
 |   Return Values :  E_OK              - success
 |                    E_BAD_ARGUMENT    - invalid options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_form_opts(FORM *form, Form_Options opts)
 {
   T((T_CALLED("set_form_opts(%p,%d)"), (void *)form, opts));
@@ -67,7 +67,7 @@
 |
 |   Return Values :  The option flags.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(Form_Options)
+NCFORM_EXPORT(Form_Options)
 form_opts(const FORM *form)
 {
   T((T_CALLED("form_opts(%p)"), (const void *)form));
@@ -84,7 +84,7 @@
 |   Return Values :  E_OK            - success 
 |                    E_BAD_ARGUMENT  - invalid options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 form_opts_on(FORM *form, Form_Options opts)
 {
   T((T_CALLED("form_opts_on(%p,%d)"), (void *)form, opts));
@@ -109,7 +109,7 @@
 |   Return Values :  E_OK            - success 
 |                    E_BAD_ARGUMENT  - invalid options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 form_opts_off(FORM *form, Form_Options opts)
 {
   T((T_CALLED("form_opts_off(%p,%d)"), (void *)form, opts));
diff -ur ncurses-5.9-orig/form/frm_page.c ncurses-5.9/form/frm_page.c
--- ncurses-5.9-orig/form/frm_page.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/frm_page.c	2013-07-04 18:38:37 -0400
@@ -46,7 +46,7 @@
 |                    E_INVALID_FIELD   - current field can't be left
 |                    E_SYSTEM_ERROR    - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_form_page(FORM *form, int page)
 {
   int err = E_OK;
@@ -95,7 +95,7 @@
 |   Return Values :  >= 0  : current page number
 |                    -1    : invalid form pointer
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 form_page(const FORM *form)
 {
   T((T_CALLED("form_page(%p)"), (const void *)form));
diff -ur ncurses-5.9-orig/form/frm_post.c ncurses-5.9/form/frm_post.c
--- ncurses-5.9-orig/form/frm_post.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/frm_post.c	2013-07-04 18:38:37 -0400
@@ -47,7 +47,7 @@
 |                    E_NO_ROOM         - form doesn't fit into subwindow
 |                    E_SYSTEM_ERROR    - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 post_form(FORM *form)
 {
   WINDOW *formwin;
@@ -97,7 +97,7 @@
 |                    E_NOT_POSTED    - form isn't posted
 |                    E_BAD_STATE     - called from a hook routine
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 unpost_form(FORM *form)
 {
   T((T_CALLED("unpost_form(%p)"), (void *)form));
diff -ur ncurses-5.9-orig/form/frm_req_name.c ncurses-5.9/form/frm_req_name.c
--- ncurses-5.9-orig/form/frm_req_name.c	2009-10-10 12:17:01 -0400
+++ ncurses-5.9/form/frm_req_name.c	2013-07-04 18:38:37 -0400
@@ -115,7 +115,7 @@
 |   Return Values :  Pointer to name      - on success
 |                    NULL                 - on invalid request code
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(const char *)
+NCFORM_EXPORT(const char *)
 form_request_name(int request)
 {
   T((T_CALLED("form_request_name(%d)"), request));
@@ -138,7 +138,7 @@
 |   Return Values :  Request Id       - on success
 |                    E_NO_MATCH       - request not found
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 form_request_by_name(const char *str)
 {
   /* because the table is so small, it doesn't really hurt
diff -ur ncurses-5.9-orig/form/frm_scale.c ncurses-5.9/form/frm_scale.c
--- ncurses-5.9-orig/form/frm_scale.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/frm_scale.c	2013-07-04 18:38:37 -0400
@@ -44,7 +44,7 @@
 |                    E_BAD_ARGUMENT    - invalid form pointer
 |                    E_NOT_CONNECTED   - no fields connected to form
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 scale_form(const FORM *form, int *rows, int *cols)
 {
   T((T_CALLED("scale_form(%p,%p,%p)"),
diff -ur ncurses-5.9-orig/form/frm_sub.c ncurses-5.9/form/frm_sub.c
--- ncurses-5.9-orig/form/frm_sub.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/frm_sub.c	2013-07-04 18:38:37 -0400
@@ -43,7 +43,7 @@
 |   Return Values :  E_OK       - success
 |                    E_POSTED   - form is posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_form_sub(FORM *form, WINDOW *win)
 {
   T((T_CALLED("set_form_sub(%p,%p)"), (void *)form, (void *)win));
@@ -72,7 +72,7 @@
 |
 |   Return Values :  The pointer to the Subwindow.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(WINDOW *)
+NCFORM_EXPORT(WINDOW *)
 form_sub(const FORM *form)
 {
   const FORM *f;
diff -ur ncurses-5.9-orig/form/frm_user.c ncurses-5.9/form/frm_user.c
--- ncurses-5.9-orig/form/frm_user.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/frm_user.c	2013-07-04 18:38:37 -0400
@@ -43,7 +43,7 @@
 |
 |   Return Values :  E_OK         - on success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_form_userptr(FORM *form, void *usrptr)
 {
   T((T_CALLED("set_form_userptr(%p,%p)"), (void *)form, (void *)usrptr));
@@ -62,7 +62,7 @@
 |   Return Values :  Value of pointer. If no such pointer has been set,
 |                    NULL is returned
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void *)
+NCFORM_EXPORT(void *)
 form_userptr(const FORM *form)
 {
   T((T_CALLED("form_userptr(%p)"), (const void *)form));
diff -ur ncurses-5.9-orig/form/frm_win.c ncurses-5.9/form/frm_win.c
--- ncurses-5.9-orig/form/frm_win.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/frm_win.c	2013-07-04 18:38:37 -0400
@@ -43,7 +43,7 @@
 |   Return Values :  E_OK       - success
 |                    E_POSTED   - form is posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 set_form_win(FORM *form, WINDOW *win)
 {
   T((T_CALLED("set_form_win(%p,%p)"), (void *)form, (void *)win));
@@ -72,7 +72,7 @@
 |
 |   Return Values :  The pointer to the Window or stdscr if there is none.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(WINDOW *)
+NCFORM_EXPORT(WINDOW *)
 form_win(const FORM *form)
 {
   WINDOW *result;
diff -ur ncurses-5.9-orig/form/fty_alnum.c ncurses-5.9/form/fty_alnum.c
--- ncurses-5.9-orig/form/fty_alnum.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/fty_alnum.c	2013-07-04 18:38:37 -0400
@@ -185,14 +185,14 @@
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALNUM = &typeTHIS;
+NCFORM_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 *)
+NCFORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_ALNUM(void)
 {
   return TYPE_ALNUM;
diff -ur ncurses-5.9-orig/form/fty_alpha.c ncurses-5.9/form/fty_alpha.c
--- ncurses-5.9-orig/form/fty_alpha.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/fty_alpha.c	2013-07-04 18:38:37 -0400
@@ -185,14 +185,14 @@
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALPHA = &typeTHIS;
+NCFORM_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 *)
+NCFORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_ALPHA(void)
 {
   return TYPE_ALPHA;
diff -ur ncurses-5.9-orig/form/fty_enum.c ncurses-5.9/form/fty_enum.c
--- ncurses-5.9-orig/form/fty_enum.c	2010-05-01 17:11:07 -0400
+++ ncurses-5.9/form/fty_enum.c	2013-07-04 18:38:37 -0400
@@ -424,7 +424,7 @@
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE *)
+NCFORM_EXPORT_VAR(FIELDTYPE *)
 TYPE_ENUM = &typeENUM;
 
 #if NCURSES_INTEROP_FUNCS
@@ -432,7 +432,7 @@
    programming languages with restictions on interop with C level
    constructs (e.g. variable access or va_list + ellipsis constructs)
 */
-NCURSES_EXPORT(FIELDTYPE *)
+NCFORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_ENUM(void)
 {
   return TYPE_ENUM;
diff -ur ncurses-5.9-orig/form/fty_generic.c ncurses-5.9/form/fty_generic.c
--- ncurses-5.9-orig/form/fty_generic.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/fty_generic.c	2013-07-04 18:38:37 -0400
@@ -98,7 +98,7 @@
 |
 |   Return Values :  Fieldtype pointer or NULL if error occurred
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELDTYPE *)
+NCFORM_EXPORT(FIELDTYPE *)
 _nc_generic_fieldtype(bool (*const field_check) (FORM *, FIELD *, const void *),
 		      bool (*const char_check) (int, FORM *, FIELD *, const
 						void *),
@@ -213,7 +213,7 @@
 |   Return Values :  E_OK if all went well
 |                    E_SYSTEM_ERROR if an error occurred
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCFORM_EXPORT(int)
 _nc_set_generic_fieldtype(FIELD *field,
 			  FIELDTYPE *ftyp,
 			  int (*argiterator) (void **))
@@ -268,7 +268,7 @@
 |
 |   Return Values :  The fields Window or NULL on error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(WINDOW *)
+NCFORM_EXPORT(WINDOW *)
 _nc_form_cursor(const FORM *form, int *pRow, int *pCol)
 {
   int code = E_SYSTEM_ERROR;
diff -ur ncurses-5.9-orig/form/fty_int.c ncurses-5.9/form/fty_int.c
--- ncurses-5.9-orig/form/fty_int.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/fty_int.c	2013-07-04 18:38:37 -0400
@@ -276,14 +276,14 @@
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_INTEGER = &typeTHIS;
+NCFORM_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 *)
+NCFORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_INTEGER(void)
 {
   return TYPE_INTEGER;
diff -ur ncurses-5.9-orig/form/fty_ipv4.c ncurses-5.9/form/fty_ipv4.c
--- ncurses-5.9-orig/form/fty_ipv4.c	2009-11-07 15:17:58 -0500
+++ ncurses-5.9/form/fty_ipv4.c	2013-07-04 18:38:37 -0400
@@ -103,14 +103,14 @@
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_IPV4 = &typeIPV4;
+NCFORM_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 *)
+NCFORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_IPV4(void)
 {
   return TYPE_IPV4;
diff -ur ncurses-5.9-orig/form/fty_num.c ncurses-5.9/form/fty_num.c
--- ncurses-5.9-orig/form/fty_num.c	2010-01-23 16:14:36 -0500
+++ ncurses-5.9/form/fty_num.c	2013-07-04 18:38:37 -0400
@@ -322,14 +322,14 @@
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_NUMERIC = &typeTHIS;
+NCFORM_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 *)
+NCFORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_NUMERIC(void)
 {
   return TYPE_NUMERIC;
diff -ur ncurses-5.9-orig/form/fty_regex.c ncurses-5.9/form/fty_regex.c
--- ncurses-5.9-orig/form/fty_regex.c	2010-01-23 16:14:37 -0500
+++ ncurses-5.9/form/fty_regex.c	2013-07-04 18:38:37 -0400
@@ -333,14 +333,14 @@
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_REGEXP = &typeREGEXP;
+NCFORM_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 *)
+NCFORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_REGEXP(void)
 {
   return TYPE_REGEXP;
diff -ur ncurses-5.9-orig/include/MKkey_defs.sh ncurses-5.9/include/MKkey_defs.sh
--- ncurses-5.9-orig/include/MKkey_defs.sh	2003-12-06 12:10:09 -0500
+++ ncurses-5.9/include/MKkey_defs.sh	2013-07-04 18:38:37 -0400
@@ -62,7 +62,7 @@
 # add keys that we generate automatically:
 cat >>$data <<EOF
 key_resize	kr1	str	R1	KEY_RESIZE	+	-----	Terminal resize event
-key_event	kv1	str	V1	KEY_EVENT	+	-----	We were interrupted by an event
+key_event	kv1	str	V1	KEY_EVENT_	+	-----	We were interrupted by an event
 EOF
 
 cat <<EOF
diff -ur ncurses-5.9-orig/include/MKterm.h.awk.in ncurses-5.9/include/MKterm.h.awk.in
--- ncurses-5.9-orig/include/MKterm.h.awk.in	2010-01-09 14:53:26 -0500
+++ ncurses-5.9/include/MKterm.h.awk.in	2013-07-04 18:38:37 -0400
@@ -130,7 +130,7 @@
 		    print  ""
 		    print  "#else /* !HAVE_TERMIO_H */"
 		    print  ""
-		    print  "#if __MINGW32__"
+		    print  "#if __MINGW32__ || defined(_MSC_VER)"
 		    print  "#  include <ncurses_mingw.h>"
 		    print  "#  define TTY struct termios"
 		    print  "#else"
diff -ur ncurses-5.9-orig/include/nc_mingw.h ncurses-5.9/include/nc_mingw.h
--- ncurses-5.9-orig/include/nc_mingw.h	2010-09-25 18:16:12 -0400
+++ ncurses-5.9/include/nc_mingw.h	2013-07-04 18:38:37 -0400
@@ -43,6 +43,7 @@
 #else
 #  define WINVER 0x0501
 #endif
+#include <winsock2.h>
 #include <windows.h>
 
 #undef sleep
@@ -51,7 +52,9 @@
 #undef gettimeofday
 #define gettimeofday(tv,tz) _nc_gettimeofday(tv,tz)
 
+#ifndef _MSC_VER
 #include <sys/time.h>	/* for struct timeval */
+#endif
 
 extern int _nc_gettimeofday(struct timeval *, void *);
 
diff -ur ncurses-5.9-orig/include/ncurses_dll.h.in ncurses-5.9/include/ncurses_dll.h.in
--- ncurses-5.9-orig/include/ncurses_dll.h.in	2009-04-04 18:26:27 -0400
+++ ncurses-5.9/include/ncurses_dll.h.in	2013-07-04 18:38:37 -0400
@@ -41,10 +41,9 @@
 /* but this structure may be useful at some point for an MSVC build */
 /* so, for now unconditionally define the important flags           */
 /* "the right way" for proper static and dll+auto-import behavior   */
-#undef NCURSES_DLL
-#define NCURSES_STATIC
+#undef NCURSES_STATIC
 
-#if defined(__CYGWIN__) || defined(__MINGW32__)
+#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER)
 #  if defined(NCURSES_DLL)
 #    if defined(NCURSES_STATIC)
 #      undef NCURSES_STATIC
@@ -67,6 +66,98 @@
 #  define NCURSES_API __cdecl
 #  define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
 #  define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
+
+#  if defined(NCURSESXX_DLL)
+#    if defined(NCURSES_STATIC)
+#      undef NCURSES_STATIC
+#    endif
+#  endif
+#  undef NCURSESXX_IMPEXP
+#  undef NCURSESXX_API
+#  undef NCURSESXX_EXPORT
+#  undef NCURSESXX_EXPORT_VAR
+#  if defined(NCURSESXX_DLL)
+/* building a DLL */
+#    define NCURSESXX_IMPEXP __declspec(dllexport)
+#  elif defined(NCURSES_STATIC)
+/* building or linking to a static library */
+#    define NCURSESXX_IMPEXP /* nothing */
+#  else
+/* linking to the DLL */
+#    define NCURSESXX_IMPEXP __declspec(dllimport)
+#  endif
+#  define NCURSESXX_API __cdecl
+#  define NCURSESXX_EXPORT(type) NCURSESXX_IMPEXP type NCURSESXX_API
+#  define NCURSESXX_EXPORT_VAR(type) NCURSESXX_IMPEXP type
+
+#  if defined(NCMENU_DLL)
+#    if defined(NCURSES_STATIC)
+#      undef NCURSES_STATIC
+#    endif
+#  endif
+#  undef NCMENU_IMPEXP
+#  undef NCMENU_API
+#  undef NCMENU_EXPORT
+#  undef NCMENU_EXPORT_VAR
+#  if defined(NCMENU_DLL)
+/* building a DLL */
+#    define NCMENU_IMPEXP __declspec(dllexport)
+#  elif defined(NCURSES_STATIC)
+/* building or linking to a static library */
+#    define NCMENU_IMPEXP /* nothing */
+#  else
+/* linking to the DLL */
+#    define NCMENU_IMPEXP __declspec(dllimport)
+#  endif
+#  define NCMENU_API __cdecl
+#  define NCMENU_EXPORT(type) NCMENU_IMPEXP type NCMENU_API
+#  define NCMENU_EXPORT_VAR(type) NCMENU_IMPEXP type
+
+#  if defined(NCPANEL_DLL)
+#    if defined(NCURSES_STATIC)
+#      undef NCURSES_STATIC
+#    endif
+#  endif
+#  undef NCPANEL_IMPEXP
+#  undef NCPANEL_API
+#  undef NCPANEL_EXPORT
+#  undef NCPANEL_EXPORT_VAR
+#  if defined(NCPANEL_DLL)
+/* building a DLL */
+#    define NCPANEL_IMPEXP __declspec(dllexport)
+#  elif defined(NCURSES_STATIC)
+/* building or linking to a static library */
+#    define NCPANEL_IMPEXP /* nothing */
+#  else
+/* linking to the DLL */
+#    define NCPANEL_IMPEXP __declspec(dllimport)
+#  endif
+#  define NCPANEL_API __cdecl
+#  define NCPANEL_EXPORT(type) NCPANEL_IMPEXP type NCPANEL_API
+#  define NCPANEL_EXPORT_VAR(type) NCPANEL_IMPEXP type
+
+#  if defined(NCFORM_DLL)
+#    if defined(NCURSES_STATIC)
+#      undef NCURSES_STATIC
+#    endif
+#  endif
+#  undef NCFORM_IMPEXP
+#  undef NCFORM_API
+#  undef NCFORM_EXPORT
+#  undef NCFORM_EXPORT_VAR
+#  if defined(NCFORM_DLL)
+/* building a DLL */
+#    define NCFORM_IMPEXP __declspec(dllexport)
+#  elif defined(NCURSES_STATIC)
+/* building or linking to a static library */
+#    define NCFORM_IMPEXP /* nothing */
+#  else
+/* linking to the DLL */
+#    define NCFORM_IMPEXP __declspec(dllimport)
+#  endif
+#  define NCFORM_API __cdecl
+#  define NCFORM_EXPORT(type) NCFORM_IMPEXP type NCFORM_API
+#  define NCFORM_EXPORT_VAR(type) NCFORM_IMPEXP type
 #endif
 
 /* Take care of non-cygwin platforms */
@@ -83,4 +174,43 @@
 #  define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
 #endif
 
+#if !defined(NCMENU_IMPEXP)
+#  define NCMENU_IMPEXP /* nothing */
+#endif
+#if !defined(NCMENU_API)
+#  define NCMENU_API /* nothing */
+#endif
+#if !defined(NCMENU_EXPORT)
+#  define NCMENU_EXPORT(type) NCMENU_IMPEXP type NCMENU_API
+#endif
+#if !defined(NCMENU_EXPORT_VAR)
+#  define NCMENU_EXPORT_VAR(type) NCMENU_IMPEXP type
+#endif
+
+#if !defined(NCPANEL_IMPEXP)
+#  define NCPANEL_IMPEXP /* nothing */
+#endif
+#if !defined(NCPANEL_API)
+#  define NCPANEL_API /* nothing */
+#endif
+#if !defined(NCPANEL_EXPORT)
+#  define NCPANEL_EXPORT(type) NCPANEL_IMPEXP type NCPANEL_API
+#endif
+#if !defined(NCPANEL_EXPORT_VAR)
+#  define NCPANEL_EXPORT_VAR(type) NCPANEL_IMPEXP type
+#endif
+
+#if !defined(NCFORM_IMPEXP)
+#  define NCFORM_IMPEXP /* nothing */
+#endif
+#if !defined(NCFORM_API)
+#  define NCFORM_API /* nothing */
+#endif
+#if !defined(NCFORM_EXPORT)
+#  define NCFORM_EXPORT(type) NCFORM_IMPEXP type NCFORM_API
+#endif
+#if !defined(NCFORM_EXPORT_VAR)
+#  define NCFORM_EXPORT_VAR(type) NCFORM_IMPEXP type
+#endif
+
 #endif /* NCURSES_DLL_H_incl */
diff -ur ncurses-5.9-orig/include/ncurses_mingw.h ncurses-5.9/include/ncurses_mingw.h
--- ncurses-5.9-orig/include/ncurses_mingw.h	2008-12-14 14:22:16 -0500
+++ ncurses-5.9/include/ncurses_mingw.h	2013-07-04 18:38:37 -0400
@@ -38,7 +38,7 @@
  * to support I/O to external terminals with ncurses on the Windows OS.
  */
 
-#if __MINGW32__
+#if __MINGW32__ || defined(_MSC_VER)
 #ifndef _NC_MINGWH
 #define _NC_MINGWH
 
diff -ur ncurses-5.9-orig/include/term_entry.h ncurses-5.9/include/term_entry.h
--- ncurses-5.9-orig/include/term_entry.h	2009-07-11 12:52:29 -0400
+++ ncurses-5.9/include/term_entry.h	2013-07-04 18:38:37 -0400
@@ -161,8 +161,8 @@
 extern NCURSES_EXPORT(int) _nc_resolve_uses (bool); /* obs 20040705 */
 extern NCURSES_EXPORT(int) _nc_resolve_uses2 (bool, bool);
 extern NCURSES_EXPORT(void) _nc_free_entries (ENTRY *);
-extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype)(TERMTYPE *); /* obs 20040705 */
-extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype2)(TERMTYPE *, bool);
+extern NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype)(TERMTYPE *); /* obs 20040705 */
+extern NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2)(TERMTYPE *, bool);
 
 /* trace_xnames.c */
 extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *);
diff -ur ncurses-5.9-orig/include/tic.h ncurses-5.9/include/tic.h
--- ncurses-5.9-orig/include/tic.h	2009-08-08 13:52:46 -0400
+++ ncurses-5.9/include/tic.h	2013-07-04 18:38:37 -0400
@@ -299,6 +299,9 @@
 
 /* home_terminfo.c */
 extern NCURSES_EXPORT(char *) _nc_home_terminfo (void);
+#ifdef _MSC_VER
+extern NCURSES_EXPORT(char *) _nc_win32_terminfo (void);
+#endif
 
 /* lib_tparm.c */
 #define NUM_PARM 9
@@ -318,6 +321,9 @@
     dbdTIC = 0,
 #if USE_DATABASE
     dbdEnvOnce,
+#ifdef _MSC_VER
+    dbdWin32,
+#endif
     dbdHome,
     dbdEnvList,
     dbdCfgList,
diff -ur ncurses-5.9-orig/menu/Makefile.in ncurses-5.9/menu/Makefile.in
--- ncurses-5.9-orig/menu/Makefile.in	2010-11-27 16:45:27 -0500
+++ ncurses-5.9/menu/Makefile.in	2013-07-04 18:38:37 -0400
@@ -84,7 +84,7 @@
 CPP		= @CPP@
 CFLAGS		= @CFLAGS@
 
-CPPFLAGS	= -I@top_srcdir@/ncurses -DHAVE_CONFIG_H @CPPFLAGS@
+CPPFLAGS	= -I@top_srcdir@/ncurses -DHAVE_CONFIG_H -DNCMENU_DLL @CPPFLAGS@
 
 CCFLAGS		= $(CPPFLAGS) $(CFLAGS)
 
diff -ur ncurses-5.9-orig/menu/m_attribs.c ncurses-5.9/menu/m_attribs.c
--- ncurses-5.9-orig/menu/m_attribs.c	2010-01-23 16:16:54 -0500
+++ ncurses-5.9/menu/m_attribs.c	2013-07-04 18:38:37 -0400
@@ -49,7 +49,7 @@
 
 /* "Template" macro to generate a function to set a menus attribute */
 #define GEN_MENU_ATTR_SET_FCT( name ) \
-NCURSES_IMPEXP int NCURSES_API set_menu_ ## name (MENU* menu, chtype attr) \
+NCMENU_IMPEXP int NCMENU_API set_menu_ ## name (MENU* menu, chtype attr) \
 {\
   T((T_CALLED("set_menu_" #name "(%p,%s)"), menu, _traceattr(attr))); \
    if (!(attr==A_NORMAL || (attr & A_ATTRIBUTES)==attr))\
@@ -65,7 +65,7 @@
 
 /* "Template" macro to generate a function to get a menu's attribute */
 #define GEN_MENU_ATTR_GET_FCT( name ) \
-NCURSES_IMPEXP chtype NCURSES_API menu_ ## name (const MENU * menu)\
+NCMENU_IMPEXP chtype NCMENU_API menu_ ## name (const MENU * menu)\
 {\
    T((T_CALLED("menu_" #name "(%p)"), (const void *) menu));\
    returnAttr(Normalize_Menu( menu ) -> name);\
diff -ur ncurses-5.9-orig/menu/m_cursor.c ncurses-5.9/menu/m_cursor.c
--- ncurses-5.9-orig/menu/m_cursor.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_cursor.c	2013-07-04 18:38:37 -0400
@@ -49,7 +49,7 @@
 |                    E_BAD_ARGUMENT  - invalid menu
 |                    E_NOT_POSTED    - Menu is not posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 _nc_menu_cursor_pos(const MENU * menu, const ITEM * item, int *pY, int *pX)
 {
   if (!menu || !pX || !pY)
@@ -79,7 +79,7 @@
 |                    E_BAD_ARGUMENT  - invalid menu
 |                    E_NOT_POSTED    - Menu is not posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 pos_menu_cursor(const MENU * menu)
 {
   WINDOW *win, *sub;
diff -ur ncurses-5.9-orig/menu/m_driver.c ncurses-5.9/menu/m_driver.c
--- ncurses-5.9-orig/menu/m_driver.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_driver.c	2013-07-04 18:38:37 -0400
@@ -114,7 +114,7 @@
 |   Return Values :  E_OK        - an item matching the pattern was found
 |                    E_NO_MATCH  - nothing found
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 _nc_Match_Next_Character_In_Item_Name
 (MENU * menu, int ch, ITEM ** item)
 {
@@ -208,7 +208,7 @@
 |                    E_BAD_STATE     - menu is in user hook routine
 |                    E_NOT_POSTED    - menu is not posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 menu_driver(MENU * menu, int c)
 {
 #define NAVIGATE(dir) \
diff -ur ncurses-5.9-orig/menu/m_format.c ncurses-5.9/menu/m_format.c
--- ncurses-5.9-orig/menu/m_format.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_format.c	2013-07-04 18:38:37 -0400
@@ -55,7 +55,7 @@
 |                    E_NOT_CONNECTED        - there are no items connected
 |                    E_POSTED               - the menu is already posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 set_menu_format(MENU * menu, int rows, int cols)
 {
   int total_rows, total_cols;
@@ -119,7 +119,7 @@
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+NCMENU_EXPORT(void)
 menu_format(const MENU * menu, int *rows, int *cols)
 {
   if (rows)
diff -ur ncurses-5.9-orig/menu/m_global.c ncurses-5.9/menu/m_global.c
--- ncurses-5.9-orig/menu/m_global.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_global.c	2013-07-04 18:38:38 -0400
@@ -41,7 +41,7 @@
 
 static char mark[] = "-";
 /* *INDENT-OFF* */
-NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu = {
+NCMENU_EXPORT_VAR(MENU) _nc_Default_Menu = {
   16,				  /* Nr. of chars high */
   1,				  /* Nr. of chars wide */
   16,				  /* Nr. of items high */
@@ -80,7 +80,7 @@
   0			          /* status */	    
 };
 
-NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item = {
+NCMENU_EXPORT_VAR(ITEM) _nc_Default_Item = {
   { (char *)0, 0 },		  /* name */
   { (char *)0, 0 },		  /* description */
   (MENU *)0,		          /* Pointer to parent menu */
@@ -170,7 +170,7 @@
 |   Return Values :  TRUE       - successful connection
 |                    FALSE      - connection failed
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+NCMENU_EXPORT(bool)
 _nc_Connect_Items(MENU * menu, ITEM ** items)
 {
   ITEM **item;
@@ -232,7 +232,7 @@
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+NCMENU_EXPORT(void)
 _nc_Disconnect_Items(MENU * menu)
 {
   if (menu && menu->items)
@@ -247,7 +247,7 @@
 |
 |   Return Values :  the width
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 _nc_Calculate_Text_Width(const TEXT * item /*FIXME: limit length */ )
 {
 #if USE_WIDEC_SUPPORT
@@ -336,7 +336,7 @@
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+NCMENU_EXPORT(void)
 _nc_Calculate_Item_Length_and_Width(MENU * menu)
 {
   int l;
@@ -375,7 +375,7 @@
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+NCMENU_EXPORT(void)
 _nc_Link_Items(MENU * menu)
 {
   if (menu && menu->items && *(menu->items))
@@ -502,7 +502,7 @@
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+NCMENU_EXPORT(void)
 _nc_Show_Menu(const MENU * menu)
 {
   WINDOW *win;
@@ -542,7 +542,7 @@
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+NCMENU_EXPORT(void)
 _nc_New_TopRow_and_CurrentItem(
 				MENU * menu,
 				int new_toprow,
diff -ur ncurses-5.9-orig/menu/m_hook.c ncurses-5.9/menu/m_hook.c
--- ncurses-5.9-orig/menu/m_hook.c	2010-01-23 16:16:54 -0500
+++ ncurses-5.9/menu/m_hook.c	2013-07-04 18:38:38 -0400
@@ -41,7 +41,7 @@
 
 /* "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 (MENU *menu, Menu_Hook func )\
+NCMENU_IMPEXP int NCMENU_API set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\
 {\
    T((T_CALLED("set_" #typ "_" #name "(%p,%p)"), menu, func));\
    (Normalize_Menu(menu) -> typ ## name = func );\
@@ -50,7 +50,7 @@
 
 /* "Template" macro to generate function to get application specific hook */
 #define GEN_HOOK_GET_FUNCTION( typ, name ) \
-NCURSES_IMPEXP Menu_Hook NCURSES_API typ ## _ ## name ( const MENU *menu )\
+NCMENU_IMPEXP Menu_Hook NCMENU_API typ ## _ ## name ( const MENU *menu )\
 {\
    T((T_CALLED(#typ "_" #name "(%p)"), (const void *) menu));\
    returnMenuHook(Normalize_Menu(menu) -> typ ## name);\
diff -ur ncurses-5.9-orig/menu/m_item_cur.c ncurses-5.9/menu/m_item_cur.c
--- ncurses-5.9-orig/menu/m_item_cur.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_item_cur.c	2013-07-04 18:38:38 -0400
@@ -47,7 +47,7 @@
 |
 |   Return Values :  E_OK                - success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 set_current_item(MENU * menu, ITEM * item)
 {
   T((T_CALLED("set_current_item(%p,%p)"), (void *)menu, (void *)item));
@@ -88,7 +88,7 @@
 |
 |   Return Values :  Item pointer or NULL if failure
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(ITEM *)
+NCMENU_EXPORT(ITEM *)
 current_item(const MENU * menu)
 {
   T((T_CALLED("current_item(%p)"), (const void *)menu));
@@ -103,7 +103,7 @@
 |
 |   Return Values :  The index or ERR if this is an invalid item pointer
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 item_index(const ITEM * item)
 {
   T((T_CALLED("item_index(%p)"), (const void *)item));
diff -ur ncurses-5.9-orig/menu/m_item_nam.c ncurses-5.9/menu/m_item_nam.c
--- ncurses-5.9-orig/menu/m_item_nam.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_item_nam.c	2013-07-04 18:38:38 -0400
@@ -47,7 +47,7 @@
 |
 |   Return Values :  See above; returns NULL if item is invalid
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(const char *)
+NCMENU_EXPORT(const char *)
 item_name(const ITEM * item)
 {
   T((T_CALLED("item_name(%p)"), (const void *)item));
@@ -62,7 +62,7 @@
 |
 |   Return Values :  See above; Returns NULL if item is invalid
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(const char *)
+NCMENU_EXPORT(const char *)
 item_description(const ITEM * item)
 {
   T((T_CALLED("item_description(%p)"), (const void *)item));
diff -ur ncurses-5.9-orig/menu/m_item_new.c ncurses-5.9/menu/m_item_new.c
--- ncurses-5.9-orig/menu/m_item_new.c	2010-01-23 16:20:11 -0500
+++ ncurses-5.9/menu/m_item_new.c	2013-07-04 18:38:38 -0400
@@ -106,7 +106,7 @@
 |
 |   Return Values :  The item pointer or NULL if creation failed.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(ITEM *)
+NCMENU_EXPORT(ITEM *)
 new_item(const char *name, const char *description)
 {
   ITEM *item;
@@ -159,7 +159,7 @@
 |                    E_BAD_ARGUMENT    - invalid value has been passed
 |                    E_CONNECTED       - item is still connected to a menu    
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 free_item(ITEM * item)
 {
   T((T_CALLED("free_item(%p)"), (void *)item));
@@ -192,7 +192,7 @@
 |                    E_BAD_ARGUMENT     - an invalid value has been passed
 |                    E_SYSTEM_ERROR     - no memory to store mark
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 set_menu_mark(MENU * menu, const char *mark)
 {
   unsigned l;
@@ -265,7 +265,7 @@
 |
 |   Return Values :  The marker string pointer or NULL if no marker defined
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(const char *)
+NCMENU_EXPORT(const char *)
 menu_mark(const MENU * menu)
 {
   T((T_CALLED("menu_mark(%p)"), (const void *)menu));
diff -ur ncurses-5.9-orig/menu/m_item_opt.c ncurses-5.9/menu/m_item_opt.c
--- ncurses-5.9-orig/menu/m_item_opt.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_item_opt.c	2013-07-04 18:38:38 -0400
@@ -50,7 +50,7 @@
 |   Return Values :  E_OK            - success
 |                    E_BAD_ARGUMENT  - invalid item options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 set_item_opts(ITEM * item, Item_Options opts)
 {
   T((T_CALLED("set_menu_opts(%p,%d)"), (void *)item, opts));
@@ -93,7 +93,7 @@
 |   Return Values :  E_OK            - success
 |                    E_BAD_ARGUMENT  - invalid options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 item_opts_off(ITEM * item, Item_Options opts)
 {
   ITEM *citem = item;		/* use a copy because set_item_opts must detect
@@ -121,7 +121,7 @@
 |   Return Values :  E_OK            - success
 |                    E_BAD_ARGUMENT  - invalid options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 item_opts_on(ITEM * item, Item_Options opts)
 {
   ITEM *citem = item;		/* use a copy because set_item_opts must detect
@@ -149,7 +149,7 @@
 |
 |   Return Values :  Items options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(Item_Options)
+NCMENU_EXPORT(Item_Options)
 item_opts(const ITEM * item)
 {
   T((T_CALLED("item_opts(%p)"), (const void *)item));
diff -ur ncurses-5.9-orig/menu/m_item_top.c ncurses-5.9/menu/m_item_top.c
--- ncurses-5.9-orig/menu/m_item_top.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_item_top.c	2013-07-04 18:38:38 -0400
@@ -49,7 +49,7 @@
 |                    E_BAD_ARGUMENT   - not a menu pointer or invalid row
 |                    E_NOT_CONNECTED  - there are no items for the menu
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 set_top_row(MENU * menu, int row)
 {
   ITEM *item;
@@ -91,7 +91,7 @@
 |
 |   Return Values :  The row number or ERR if there is no row
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 top_row(const MENU * menu)
 {
   T((T_CALLED("top_row(%p)"), (const void *)menu));
diff -ur ncurses-5.9-orig/menu/m_item_use.c ncurses-5.9/menu/m_item_use.c
--- ncurses-5.9-orig/menu/m_item_use.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_item_use.c	2013-07-04 18:38:38 -0400
@@ -48,7 +48,7 @@
 |
 |   Return Values :  E_OK               - success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 set_item_userptr(ITEM * item, void *userptr)
 {
   T((T_CALLED("set_item_userptr(%p,%p)"), (void *)item, (void *)userptr));
@@ -66,7 +66,7 @@
 |   Return Values :  Value of the pointer. If no such pointer has been set,
 |                    NULL is returned.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void *)
+NCMENU_EXPORT(void *)
 item_userptr(const ITEM * item)
 {
   T((T_CALLED("item_userptr(%p)"), (const void *)item));
diff -ur ncurses-5.9-orig/menu/m_item_val.c ncurses-5.9/menu/m_item_val.c
--- ncurses-5.9-orig/menu/m_item_val.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_item_val.c	2013-07-04 18:38:38 -0400
@@ -52,7 +52,7 @@
 |   Return Values :  E_OK              - success
 |                    E_REQUEST_DENIED  - not selectable or single valued menu
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 set_item_value(ITEM * item, bool value)
 {
   MENU *menu;
@@ -94,7 +94,7 @@
 |   Return Values :  TRUE   - if item is selected
 |                    FALSE  - if item is not selected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+NCMENU_EXPORT(bool)
 item_value(const ITEM * item)
 {
   T((T_CALLED("item_value(%p)"), (const void *)item));
diff -ur ncurses-5.9-orig/menu/m_item_vis.c ncurses-5.9/menu/m_item_vis.c
--- ncurses-5.9-orig/menu/m_item_vis.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_item_vis.c	2013-07-04 18:38:38 -0400
@@ -49,7 +49,7 @@
 |   Return Values :  TRUE  if visible
 |                    FALSE if invisible
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+NCMENU_EXPORT(bool)
 item_visible(const ITEM * item)
 {
   MENU *menu;
diff -ur ncurses-5.9-orig/menu/m_items.c ncurses-5.9/menu/m_items.c
--- ncurses-5.9-orig/menu/m_items.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_items.c	2013-07-04 18:38:38 -0400
@@ -52,7 +52,7 @@
 |                    E_BAD_ARGUMENT - An incorrect menu or item array was
 |                                     passed to the function
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 set_menu_items(MENU * menu, ITEM ** items)
 {
   T((T_CALLED("set_menu_items(%p,%p)"), (void *)menu, (void *)items));
@@ -84,7 +84,7 @@
 |
 |   Return Values :  NULL on error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(ITEM **)
+NCMENU_EXPORT(ITEM **)
 menu_items(const MENU * menu)
 {
   T((T_CALLED("menu_items(%p)"), (const void *)menu));
@@ -100,7 +100,7 @@
 |
 |   Return Values :  Number of items or -1 to indicate error.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 item_count(const MENU * menu)
 {
   T((T_CALLED("item_count(%p)"), (const void *)menu));
diff -ur ncurses-5.9-orig/menu/m_new.c ncurses-5.9/menu/m_new.c
--- ncurses-5.9-orig/menu/m_new.c	2010-01-23 16:20:11 -0500
+++ ncurses-5.9/menu/m_new.c	2013-07-04 18:38:38 -0400
@@ -50,7 +50,7 @@
 |
 |   Return Values :  NULL on error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(MENU *)
+NCMENU_EXPORT(MENU *)
 NCURSES_SP_NAME(new_menu) (NCURSES_SP_DCLx ITEM ** items)
 {
   int err = E_SYSTEM_ERROR;
@@ -101,7 +101,7 @@
 |   Return Values :  NULL on error
 +--------------------------------------------------------------------------*/
 #if NCURSES_SP_FUNCS
-NCURSES_EXPORT(MENU *)
+NCMENU_EXPORT(MENU *)
 new_menu(ITEM ** items)
 {
   return NCURSES_SP_NAME(new_menu) (CURRENT_SCREEN, items);
@@ -119,7 +119,7 @@
 |                    E_BAD_ARGUMENT     - Invalid menu pointer passed
 |                    E_POSTED           - Menu is already posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 free_menu(MENU * menu)
 {
   T((T_CALLED("free_menu(%p)"), (void *)menu));
diff -ur ncurses-5.9-orig/menu/m_opts.c ncurses-5.9/menu/m_opts.c
--- ncurses-5.9-orig/menu/m_opts.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_opts.c	2013-07-04 18:38:38 -0400
@@ -52,7 +52,7 @@
 |                    E_BAD_ARGUMENT - invalid menu options
 |                    E_POSTED       - menu is already posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 set_menu_opts(MENU * menu, Menu_Options opts)
 {
   T((T_CALLED("set_menu_opts(%p,%d)"), (void *)menu, opts));
@@ -112,7 +112,7 @@
 |                    E_BAD_ARGUMENT - invalid options
 |                    E_POSTED       - menu is already posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 menu_opts_off(MENU * menu, Menu_Options opts)
 {
   MENU *cmenu = menu;		/* use a copy because set_menu_opts must detect
@@ -145,7 +145,7 @@
 |                    E_BAD_ARGUMENT - invalid menu options
 |                    E_POSTED       - menu is already posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 menu_opts_on(MENU * menu, Menu_Options opts)
 {
   MENU *cmenu = menu;		/* use a copy because set_menu_opts must detect
@@ -173,7 +173,7 @@
 |
 |   Return Values :  Menu options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(Menu_Options)
+NCMENU_EXPORT(Menu_Options)
 menu_opts(const MENU * menu)
 {
   T((T_CALLED("menu_opts(%p)"), (const void *)menu));
diff -ur ncurses-5.9-orig/menu/m_pad.c ncurses-5.9/menu/m_pad.c
--- ncurses-5.9-orig/menu/m_pad.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_pad.c	2013-07-04 18:38:38 -0400
@@ -58,7 +58,7 @@
 |   Return Values :  E_OK              - success
 |                    E_BAD_ARGUMENT    - an invalid value has been passed
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 set_menu_pad(MENU * menu, int pad)
 {
   bool do_refresh = (menu != (MENU *) 0);
@@ -85,7 +85,7 @@
 |
 |   Return Values :  The pad character
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 menu_pad(const MENU * menu)
 {
   T((T_CALLED("menu_pad(%p)"), (const void *)menu));
diff -ur ncurses-5.9-orig/menu/m_pattern.c ncurses-5.9/menu/m_pattern.c
--- ncurses-5.9-orig/menu/m_pattern.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_pattern.c	2013-07-04 18:38:38 -0400
@@ -50,7 +50,7 @@
 |                                    pattern is stored
 |                    PatternString - as expected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(char *)
+NCMENU_EXPORT(char *)
 menu_pattern(const MENU * menu)
 {
   static char empty[] = "";
@@ -72,7 +72,7 @@
 |                    E_NOT_CONNECTED   - no items connected to menu
 |                    E_NO_MATCH        - no item matches pattern
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 set_menu_pattern(MENU * menu, const char *p)
 {
   ITEM *matchitem;
diff -ur ncurses-5.9-orig/menu/m_post.c ncurses-5.9/menu/m_post.c
--- ncurses-5.9-orig/menu/m_post.c	2010-05-01 15:18:27 -0400
+++ ncurses-5.9/menu/m_post.c	2013-07-04 18:38:38 -0400
@@ -48,7 +48,7 @@
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+NCMENU_EXPORT(void)
 _nc_Post_Item(const MENU * menu, const ITEM * item)
 {
   int i;
@@ -196,7 +196,7 @@
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+NCMENU_EXPORT(void)
 _nc_Draw_Menu(const MENU * menu)
 {
   ITEM *item = menu->items[0];
@@ -266,7 +266,7 @@
 |                    E_BAD_STATE         - Menu in userexit routine
 |                    E_POSTED            - Menu already posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 post_menu(MENU * menu)
 {
   T((T_CALLED("post_menu(%p)"), (void *)menu));
@@ -338,7 +338,7 @@
 |                    E_BAD_STATE       - menu in userexit routine
 |                    E_NOT_POSTED      - menu is not posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 unpost_menu(MENU * menu)
 {
   WINDOW *win;
diff -ur ncurses-5.9-orig/menu/m_req_name.c ncurses-5.9/menu/m_req_name.c
--- ncurses-5.9-orig/menu/m_req_name.c	2009-10-10 12:17:23 -0400
+++ ncurses-5.9/menu/m_req_name.c	2013-07-04 18:38:38 -0400
@@ -71,7 +71,7 @@
 |   Return Values :  Pointer to name      - on success
 |                    NULL                 - on invalid request code
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(const char *)
+NCMENU_EXPORT(const char *)
 menu_request_name(int request)
 {
   T((T_CALLED("menu_request_name(%d)"), request));
@@ -93,7 +93,7 @@
 |   Return Values :  Request Id       - on success
 |                    E_NO_MATCH       - request not found
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 menu_request_by_name(const char *str)
 {
   /* because the table is so small, it doesn't really hurt
diff -ur ncurses-5.9-orig/menu/m_scale.c ncurses-5.9/menu/m_scale.c
--- ncurses-5.9-orig/menu/m_scale.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_scale.c	2013-07-04 18:38:38 -0400
@@ -50,7 +50,7 @@
 |                    E_BAD_ARGUMENT        - invalid menu pointer
 |                    E_NOT_CONNECTED       - no items are connected to menu
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 scale_menu(const MENU * menu, int *rows, int *cols)
 {
   T((T_CALLED("scale_menu(%p,%p,%p)"),
diff -ur ncurses-5.9-orig/menu/m_spacing.c ncurses-5.9/menu/m_spacing.c
--- ncurses-5.9-orig/menu/m_spacing.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_spacing.c	2013-07-04 18:38:38 -0400
@@ -51,7 +51,7 @@
 |
 |   Return Values :  E_OK                 - on success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 set_menu_spacing(MENU * menu, int s_desc, int s_row, int s_col)
 {
   MENU *m;			/* split for ATAC workaround */
@@ -86,7 +86,7 @@
 |
 |   Return Values :  E_OK             - on success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 menu_spacing(const MENU * menu, int *s_desc, int *s_row, int *s_col)
 {
   const MENU *m;		/* split for ATAC workaround */
diff -ur ncurses-5.9-orig/menu/m_sub.c ncurses-5.9/menu/m_sub.c
--- ncurses-5.9-orig/menu/m_sub.c	2010-01-23 16:20:11 -0500
+++ ncurses-5.9/menu/m_sub.c	2013-07-04 18:38:38 -0400
@@ -48,7 +48,7 @@
 |   Return Values :  E_OK           - success
 |                    E_POSTED       - menu is already posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 set_menu_sub(MENU * menu, WINDOW *win)
 {
   T((T_CALLED("set_menu_sub(%p,%p)"), (void *)menu, (void *)win));
@@ -88,7 +88,7 @@
 |
 |   Return Values :  NULL on error, otherwise a pointer to the window
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(WINDOW *)
+NCMENU_EXPORT(WINDOW *)
 menu_sub(const MENU * menu)
 {
   const MENU *m = Normalize_Menu(menu);
diff -ur ncurses-5.9-orig/menu/m_trace.c ncurses-5.9/menu/m_trace.c
--- ncurses-5.9-orig/menu/m_trace.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_trace.c	2013-07-04 18:38:38 -0400
@@ -34,42 +34,42 @@
 
 MODULE_ID("$Id: m_trace.c,v 1.4 2010/01/23 21:20:10 tom Exp $")
 
-NCURSES_EXPORT(ITEM *)
+NCMENU_EXPORT(ITEM *)
 _nc_retrace_item(ITEM * code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(ITEM **)
+NCMENU_EXPORT(ITEM **)
 _nc_retrace_item_ptr(ITEM ** code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(Item_Options)
+NCMENU_EXPORT(Item_Options)
 _nc_retrace_item_opts(Item_Options code)
 {
   T((T_RETURN("%d"), code));
   return code;
 }
 
-NCURSES_EXPORT(MENU *)
+NCMENU_EXPORT(MENU *)
 _nc_retrace_menu(MENU * code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(Menu_Hook)
+NCMENU_EXPORT(Menu_Hook)
 _nc_retrace_menu_hook(Menu_Hook code)
 {
   T((T_RETURN("%p"), code));
   return code;
 }
 
-NCURSES_EXPORT(Menu_Options)
+NCMENU_EXPORT(Menu_Options)
 _nc_retrace_menu_opts(Menu_Options code)
 {
   T((T_RETURN("%d"), code));
diff -ur ncurses-5.9-orig/menu/m_userptr.c ncurses-5.9/menu/m_userptr.c
--- ncurses-5.9-orig/menu/m_userptr.c	2010-01-23 16:20:10 -0500
+++ ncurses-5.9/menu/m_userptr.c	2013-07-04 18:38:38 -0400
@@ -48,7 +48,7 @@
 |
 |   Return Values :  E_OK         - success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 set_menu_userptr(MENU * menu, void *userptr)
 {
   T((T_CALLED("set_menu_userptr(%p,%p)"), (void *)menu, (void *)userptr));
@@ -66,7 +66,7 @@
 |   Return Values :  Value of the pointer. If no such pointer has been set,
 |                    NULL is returned
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void *)
+NCMENU_EXPORT(void *)
 menu_userptr(const MENU * menu)
 {
   T((T_CALLED("menu_userptr(%p)"), (const void *)menu));
diff -ur ncurses-5.9-orig/menu/m_win.c ncurses-5.9/menu/m_win.c
--- ncurses-5.9-orig/menu/m_win.c	2010-01-23 16:20:11 -0500
+++ ncurses-5.9/menu/m_win.c	2013-07-04 18:38:38 -0400
@@ -48,7 +48,7 @@
 |   Return Values :  E_OK               - success
 |                    E_POSTED           - menu is already posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+NCMENU_EXPORT(int)
 set_menu_win(MENU * menu, WINDOW *win)
 {
   T((T_CALLED("set_menu_win(%p,%p)"), (void *)menu, (void *)win));
@@ -88,7 +88,7 @@
 |
 |   Return Values :  NULL on error, otherwise pointer to window
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(WINDOW *)
+NCMENU_EXPORT(WINDOW *)
 menu_win(const MENU * menu)
 {
   const MENU *m = Normalize_Menu(menu);
diff -ur ncurses-5.9-orig/menu/menu.h ncurses-5.9/menu/menu.h
--- ncurses-5.9-orig/menu/menu.h	2009-04-04 20:28:07 -0400
+++ ncurses-5.9/menu/menu.h	2013-07-04 18:38:38 -0400
@@ -172,85 +172,85 @@
 
 /* --------- 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 NCMENU_EXPORT(ITEM **)	menu_items (const MENU *);
+extern NCMENU_EXPORT(ITEM *)	current_item (const MENU *);
+extern NCMENU_EXPORT(ITEM *)	new_item (const char *,const char *);
+
+extern NCMENU_EXPORT(MENU *)	new_menu (ITEM **);
+
+extern NCMENU_EXPORT(Item_Options)	item_opts (const ITEM *);
+extern NCMENU_EXPORT(Menu_Options)	menu_opts (const MENU *);
+
+extern NCMENU_EXPORT(Menu_Hook)	item_init (const MENU *);
+extern NCMENU_EXPORT(Menu_Hook)	item_term (const MENU *);
+extern NCMENU_EXPORT(Menu_Hook)	menu_init (const MENU *);
+extern NCMENU_EXPORT(Menu_Hook)	menu_term (const MENU *);
+
+extern NCMENU_EXPORT(WINDOW *)	menu_sub (const MENU *);
+extern NCMENU_EXPORT(WINDOW *)	menu_win (const MENU *);
+
+extern NCMENU_EXPORT(const char *)	item_description (const ITEM *);
+extern NCMENU_EXPORT(const char *)	item_name (const ITEM *);
+extern NCMENU_EXPORT(const char *)	menu_mark (const MENU *);
+extern NCMENU_EXPORT(const char *)	menu_request_name (int);
+
+extern NCMENU_EXPORT(char *)	menu_pattern (const MENU *);
+
+extern NCMENU_EXPORT(void *)	menu_userptr (const MENU *);
+extern NCMENU_EXPORT(void *)	item_userptr (const ITEM *);
+
+extern NCMENU_EXPORT(chtype)	menu_back (const MENU *);
+extern NCMENU_EXPORT(chtype)	menu_fore (const MENU *);
+extern NCMENU_EXPORT(chtype)	menu_grey (const MENU *);
+
+extern NCMENU_EXPORT(int)	free_item (ITEM *);
+extern NCMENU_EXPORT(int)	free_menu (MENU *);
+extern NCMENU_EXPORT(int)	item_count (const MENU *);
+extern NCMENU_EXPORT(int)	item_index (const ITEM *);
+extern NCMENU_EXPORT(int)	item_opts_off (ITEM *,Item_Options);
+extern NCMENU_EXPORT(int)	item_opts_on (ITEM *,Item_Options);
+extern NCMENU_EXPORT(int)	menu_driver (MENU *,int);
+extern NCMENU_EXPORT(int)	menu_opts_off (MENU *,Menu_Options);
+extern NCMENU_EXPORT(int)	menu_opts_on (MENU *,Menu_Options);
+extern NCMENU_EXPORT(int)	menu_pad (const MENU *);
+extern NCMENU_EXPORT(int)	pos_menu_cursor (const MENU *);
+extern NCMENU_EXPORT(int)	post_menu (MENU *);
+extern NCMENU_EXPORT(int)	scale_menu (const MENU *,int *,int *);
+extern NCMENU_EXPORT(int)	set_current_item (MENU *menu,ITEM *item);
+extern NCMENU_EXPORT(int)	set_item_init (MENU *, Menu_Hook);
+extern NCMENU_EXPORT(int)	set_item_opts (ITEM *,Item_Options);
+extern NCMENU_EXPORT(int)	set_item_term (MENU *, Menu_Hook);
+extern NCMENU_EXPORT(int)	set_item_userptr (ITEM *, void *);
+extern NCMENU_EXPORT(int)	set_item_value (ITEM *,bool);
+extern NCMENU_EXPORT(int)	set_menu_back (MENU *,chtype);
+extern NCMENU_EXPORT(int)	set_menu_fore (MENU *,chtype);
+extern NCMENU_EXPORT(int)	set_menu_format (MENU *,int,int);
+extern NCMENU_EXPORT(int)	set_menu_grey (MENU *,chtype);
+extern NCMENU_EXPORT(int)	set_menu_init (MENU *, Menu_Hook);
+extern NCMENU_EXPORT(int)	set_menu_items (MENU *,ITEM **);
+extern NCMENU_EXPORT(int)	set_menu_mark (MENU *, const char *);
+extern NCMENU_EXPORT(int)	set_menu_opts (MENU *,Menu_Options);
+extern NCMENU_EXPORT(int)	set_menu_pad (MENU *,int);
+extern NCMENU_EXPORT(int)	set_menu_pattern (MENU *,const char *);
+extern NCMENU_EXPORT(int)	set_menu_sub (MENU *,WINDOW *);
+extern NCMENU_EXPORT(int)	set_menu_term (MENU *, Menu_Hook);
+extern NCMENU_EXPORT(int)	set_menu_userptr (MENU *,void *);
+extern NCMENU_EXPORT(int)	set_menu_win (MENU *,WINDOW *);
+extern NCMENU_EXPORT(int)	set_top_row (MENU *,int);
+extern NCMENU_EXPORT(int)	top_row (const MENU *);
+extern NCMENU_EXPORT(int)	unpost_menu (MENU *);
+extern NCMENU_EXPORT(int)	menu_request_by_name (const char *);
+extern NCMENU_EXPORT(int)	set_menu_spacing (MENU *,int,int,int);
+extern NCMENU_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 NCMENU_EXPORT(bool)	item_value (const ITEM *);
+extern NCMENU_EXPORT(bool)	item_visible (const ITEM *);
 
-extern NCURSES_EXPORT(void)	menu_format (const MENU *,int *,int *);
+extern NCMENU_EXPORT(void)	menu_format (const MENU *,int *,int *);
 
 #if NCURSES_SP_FUNCS
-extern NCURSES_EXPORT(MENU *)	NCURSES_SP_NAME(new_menu) (SCREEN*, ITEM **);
+extern NCMENU_EXPORT(MENU *)	NCURSES_SP_NAME(new_menu) (SCREEN*, ITEM **);
 #endif
 
 #ifdef __cplusplus
diff -ur ncurses-5.9-orig/menu/menu.priv.h ncurses-5.9/menu/menu.priv.h
--- ncurses-5.9-orig/menu/menu.priv.h	2009-02-28 16:02:57 -0500
+++ ncurses-5.9/menu/menu.priv.h	2013-07-04 18:38:38 -0400
@@ -47,8 +47,8 @@
 /* Backspace code */
 #define BS (8)
 
-extern NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item;
-extern NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu;
+extern NCMENU_EXPORT_VAR(ITEM) _nc_Default_Item;
+extern NCMENU_EXPORT_VAR(MENU) _nc_Default_Menu;
 
 /* Normalize item to default if none was given */
 #define Normalize_Item( item ) ((item)=(item)?(item):&_nc_Default_Item)
@@ -113,17 +113,17 @@
 #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 NCMENU_EXPORT(void) _nc_Draw_Menu (const MENU *);
+extern NCMENU_EXPORT(void) _nc_Show_Menu (const MENU *);
+extern NCMENU_EXPORT(void) _nc_Calculate_Item_Length_and_Width (MENU *);
+extern NCMENU_EXPORT(int)  _nc_Calculate_Text_Width(const TEXT *);
+extern NCMENU_EXPORT(void) _nc_Post_Item (const MENU *, const ITEM *);
+extern NCMENU_EXPORT(bool) _nc_Connect_Items (MENU *, ITEM **);
+extern NCMENU_EXPORT(void) _nc_Disconnect_Items (MENU *);
+extern NCMENU_EXPORT(void) _nc_New_TopRow_and_CurrentItem (MENU *,int, ITEM *);
+extern NCMENU_EXPORT(void) _nc_Link_Items (MENU *);
+extern NCMENU_EXPORT(int)  _nc_Match_Next_Character_In_Item_Name (MENU*,int,ITEM**);
+extern NCMENU_EXPORT(int)  _nc_menu_cursor_pos (const MENU* menu, const ITEM* item,
 				int* pY, int* pX);
 
 #ifdef TRACE
@@ -135,12 +135,12 @@
 #define returnMenuHook(code)	TRACE_RETURN(code,menu_hook)
 #define returnMenuOpts(code)	TRACE_RETURN(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 NCMENU_EXPORT(ITEM *)	    _nc_retrace_item (ITEM *);
+extern NCMENU_EXPORT(ITEM **)	    _nc_retrace_item_ptr (ITEM **);
+extern NCMENU_EXPORT(Item_Options) _nc_retrace_item_opts (Item_Options);
+extern NCMENU_EXPORT(MENU *)	    _nc_retrace_menu (MENU *);
+extern NCMENU_EXPORT(Menu_Hook)    _nc_retrace_menu_hook (Menu_Hook);
+extern NCMENU_EXPORT(Menu_Options) _nc_retrace_menu_opts (Menu_Options);
 
 #else /* !TRACE */
 
diff -ur ncurses-5.9-orig/mk-1st.awk ncurses-5.9/mk-1st.awk
--- ncurses-5.9-orig/mk-1st.awk	2010-08-07 16:42:30 -0400
+++ ncurses-5.9/mk-1st.awk	2013-07-04 18:38:38 -0400
@@ -396,11 +396,11 @@
 				end_name = lib_name;
 				printf "../lib/%s : $(%s_OBJS)\n", lib_name, OBJS
 				if ( is_ticlib() ) {
-					printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) -o %s $(%s_OBJS:$o=.lo) -rpath $(DESTDIR)$(libdir) %s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(TICS_LIST)\n", compile, lib_name, OBJS, libtool_version
+					printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) -shared -o %s $(%s_OBJS:$o=.lo) -rpath $(DESTDIR)$(libdir) %s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(TICS_LIST)\n", compile, lib_name, OBJS, libtool_version
 				} else if ( is_termlib() ) {
-					printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) -o %s $(%s_OBJS:$o=.lo) -rpath $(DESTDIR)$(libdir) %s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(TINFO_LIST)\n", compile, lib_name, OBJS, libtool_version
+					printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) -shared -o %s $(%s_OBJS:$o=.lo) -rpath $(DESTDIR)$(libdir) %s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(TINFO_LIST)\n", compile, lib_name, OBJS, libtool_version
 				} else {
-					printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) -o %s $(%s_OBJS:$o=.lo) -rpath $(DESTDIR)$(libdir) %s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(SHLIB_LIST)\n", compile, lib_name, OBJS, libtool_version
+					printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) -shared -o %s $(%s_OBJS:$o=.lo) -rpath $(DESTDIR)$(libdir) %s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(SHLIB_LIST)\n", compile, lib_name, OBJS, libtool_version
 				}
 				print  ""
 				print  "install \\"
diff -ur ncurses-5.9-orig/mk-2nd.awk ncurses-5.9/mk-2nd.awk
--- ncurses-5.9-orig/mk-2nd.awk	2005-01-22 11:30:04 -0500
+++ ncurses-5.9/mk-2nd.awk	2013-07-04 18:38:38 -0400
@@ -122,7 +122,7 @@
 				} else if ( subset ~ /termlib/ ) {
 					mycflags=" -DUSE_TERMLIB"
 				}
-				printf "$(LIBTOOL_COMPILE) $(%s) $(CFLAGS_%s)%s -c ", compile, MODEL, mycflags
+				printf "$(LIBTOOL_COMPILE) $(%s) -shared $(CFLAGS_%s)%s -c ", compile, MODEL, mycflags
 				if ( $3 == "." || srcdir == "." ) {
 					dir = $3 "/"
 					sub("^\\$\\(srcdir\\)/","",dir);
diff -ur ncurses-5.9-orig/ncurses/Makefile.in ncurses-5.9/ncurses/Makefile.in
--- ncurses-5.9-orig/ncurses/Makefile.in	2010-11-27 16:45:27 -0500
+++ ncurses-5.9/ncurses/Makefile.in	2013-07-04 18:38:38 -0400
@@ -93,7 +93,7 @@
 CFLAGS		= @CFLAGS@
 
 INCDIR		= $(srcdir)/../include
-CPPFLAGS	= -DHAVE_CONFIG_H -I../ncurses -I$(srcdir) @CPPFLAGS@
+CPPFLAGS	= -DHAVE_CONFIG_H -DNCURSES_DLL -I../ncurses -I$(srcdir) @CPPFLAGS@
 
 CCFLAGS		= $(CPPFLAGS) $(CFLAGS)
 
diff -ur ncurses-5.9-orig/ncurses/base/MKlib_gen.sh ncurses-5.9/ncurses/base/MKlib_gen.sh
--- ncurses-5.9-orig/ncurses/base/MKlib_gen.sh	2011-01-22 14:47:29 -0500
+++ ncurses-5.9/ncurses/base/MKlib_gen.sh	2013-07-04 18:38:38 -0400
@@ -159,7 +159,7 @@
 
 if test "$USE" = generated ; then
 cat >$ED4 <<EOF
-	s/^\(.*\) \(.*\) (\(.*\))\$/NCURSES_EXPORT(\1) (\2) (\3)/
+	s/^\(.*\) \(.*\) (\(.*\))\$/NCURSES_EXPORT(\1) \2 (\3)/
 EOF
 else
 cat >$ED4 <<EOF
@@ -224,6 +224,7 @@
 			break;
 		}
 	}
+	printf "UNDEF %s\n", $myfunc;
 	print $0;
 	print "{";
 	argcount = 1;
@@ -451,4 +452,5 @@
 	-e 's/^[ 	]*#/#/' \
 	-e '/#ident/d' \
 	-e '/#line/d' \
+	-e 's/UNDEF/#undef/' \
 | sed -f $ED4
diff -ur ncurses-5.9-orig/ncurses/base/lib_driver.c ncurses-5.9/ncurses/base/lib_driver.c
--- ncurses-5.9-orig/ncurses/base/lib_driver.c	2010-12-19 19:29:17 -0500
+++ ncurses-5.9/ncurses/base/lib_driver.c	2013-07-04 18:38:38 -0400
@@ -42,7 +42,7 @@
 
 static DRIVER_ENTRY DriverTable[] =
 {
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_MSC_VER)
     {"win", &_nc_WIN_DRIVER},
 #endif
     {"tinfo", &_nc_TINFO_DRIVER}
diff -ur ncurses-5.9-orig/ncurses/curses.priv.h ncurses-5.9/ncurses/curses.priv.h
--- ncurses-5.9-orig/ncurses/curses.priv.h	2011-01-22 16:10:19 -0500
+++ ncurses-5.9/ncurses/curses.priv.h	2013-07-04 18:38:38 -0400
@@ -1239,8 +1239,14 @@
 #define	W_OK	2		/* Test for write permission.  */
 #endif
 #ifndef X_OK
+#ifdef _MSC_VER
+#define X_OK    0		/* MSVC does not support X_OK and generate invalid
+                                 * parameter exception if used as argument to "access"
+                                 * function. */
+#else
 #define	X_OK	1		/* Test for execute permission.  */
 #endif
+#endif
 #ifndef F_OK
 #define	F_OK	0		/* Test for existence.  */
 #endif
@@ -1966,7 +1972,7 @@
  * Not everyone has vsscanf(), but we'd like to use it for scanw().
  */
 #if !HAVE_VSSCANF
-extern int vsscanf(const char *str, const char *format, va_list __arg);
+extern NCURSES_EXPORT(int) vsscanf(const char *str, const char *format, va_list __arg);
 #endif
 
 /* scroll indices */
@@ -2192,7 +2198,7 @@
 #endif /* !USE_TERM_DRIVER */
 
 #ifdef USE_TERM_DRIVER
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_MSC_VER)
 #include <nc_mingw.h>
 extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_WIN_DRIVER;
 #endif
diff -ur ncurses-5.9-orig/ncurses/tinfo/comp_parse.c ncurses-5.9/ncurses/tinfo/comp_parse.c
--- ncurses-5.9-orig/ncurses/tinfo/comp_parse.c	2010-12-25 18:06:37 -0500
+++ ncurses-5.9/ncurses/tinfo/comp_parse.c	2013-07-04 18:38:38 -0400
@@ -55,11 +55,11 @@
 MODULE_ID("$Id: comp_parse.c,v 1.73 2010/12/25 23:06:37 tom Exp $")
 
 static void sanity_check2(TERMTYPE *, bool);
-NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype2) (TERMTYPE *, bool) = sanity_check2;
+NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2) (TERMTYPE *, bool) = sanity_check2;
 
 /* obsolete: 20040705 */
 static void sanity_check(TERMTYPE *);
-NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype) (TERMTYPE *) = sanity_check;
+NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype) (TERMTYPE *) = sanity_check;
 
 static void
 enqueue(ENTRY * ep)
diff -ur ncurses-5.9-orig/ncurses/tinfo/db_iterator.c ncurses-5.9/ncurses/tinfo/db_iterator.c
--- ncurses-5.9-orig/ncurses/tinfo/db_iterator.c	2010-12-25 18:00:25 -0500
+++ ncurses-5.9/ncurses/tinfo/db_iterator.c	2013-07-04 18:38:38 -0400
@@ -160,6 +160,11 @@
 		    result = _nc_tic_dir(envp);
 	    }
 	    break;
+#ifdef _MSC_VER
+        case dbdWin32:
+            result = _nc_win32_terminfo();
+            break;
+#endif 
 	case dbdHome:
 	    if (use_terminfo_vars()) {
 		result = _nc_home_terminfo();
diff -ur ncurses-5.9-orig/ncurses/tinfo/home_terminfo.c ncurses-5.9/ncurses/tinfo/home_terminfo.c
--- ncurses-5.9-orig/ncurses/tinfo/home_terminfo.c	2010-12-25 18:43:58 -0500
+++ ncurses-5.9/ncurses/tinfo/home_terminfo.c	2013-07-04 18:38:38 -0400
@@ -37,6 +37,12 @@
 #include <curses.priv.h>
 #include <tic.h>
 
+#ifdef _MSC_VER
+#  include <windows.h>
+#  include <sys/types.h>
+#  include <sys/stat.h>
+#endif
+
 MODULE_ID("$Id: home_terminfo.c,v 1.12 2010/12/25 23:43:58 tom Exp $")
 
 /* ncurses extension...fall back on user's private directory */
@@ -65,3 +71,58 @@
 #endif
     return result;
 }
+
+#ifdef _MSC_VER
+NCURSES_EXPORT(char *)
+_nc_win32_terminfo(void)
+{
+    char *result = NULL;
+    static char *temp = NULL;
+    int n = 1024, nr;
+
+    if (temp == NULL) {
+        HMODULE hmod;
+
+        if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
+                              (LPCTSTR)_nc_win32_terminfo,
+                              &hmod)) {
+            do {
+                if (temp == NULL)
+                    temp = typeMalloc(char, n);
+                else {
+                    n *= 2;
+                    temp = typeRealloc(char, n, temp);
+                }
+
+                if ((nr = GetModuleFileName(hmod, temp, n)) == 0)
+                    break;
+                else if (nr < n) {
+                    char *p = strrchr(temp, '\\');
+
+                    if (p != 0) {
+                        *p = 0;
+                        nr = strlen(temp);
+                        if (nr > 4 && strncmp(&temp[nr-4], "\\bin", 4) == 0) {
+                            struct stat st;
+
+                            temp = typeRealloc(char, nr-4+64, temp);
+                            strcpy(&temp[nr-4], "\\share\\terminfo");
+                            if (stat(temp, &st) == 0 && (st.st_mode & _S_IFDIR) != 0)
+                                result = temp;
+                        }
+                    }
+                    break;
+                }
+            } while (1);
+        }
+    } else
+        result = temp;
+
+    if (result == NULL && temp != NULL) {
+        free(temp);
+        temp = NULL;
+    }
+
+    return result;
+}
+#endif
diff -ur ncurses-5.9-orig/ncurses/tinfo/lib_print.c ncurses-5.9/ncurses/tinfo/lib_print.c
--- ncurses-5.9-orig/ncurses/tinfo/lib_print.c	2010-06-05 18:18:35 -0400
+++ ncurses-5.9/ncurses/tinfo/lib_print.c	2013-07-04 18:38:38 -0400
@@ -95,7 +95,7 @@
      * kernel will ship the contiguous clist items from the last write
      * immediately.
      */
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
     (void) sleep(0);
 #endif
     free(mybuf);
diff -ur ncurses-5.9-orig/ncurses/tinfo/setbuf.c ncurses-5.9/ncurses/tinfo/setbuf.c
--- ncurses-5.9-orig/ncurses/tinfo/setbuf.c	2010-08-28 17:08:31 -0400
+++ ncurses-5.9/ncurses/tinfo/setbuf.c	2013-07-04 18:38:38 -0400
@@ -149,8 +149,13 @@
 #ifdef SETVBUF_REVERSED		/* pre-svr3? */
 	(void) setvbuf(ofp, buf_ptr, buf_len, buf_len ? _IOFBF : _IOLBF);
 #else
+#ifdef _MSC_VER
+        /* MSVC does not accept 0 as buffer size */
+	(void) setvbuf(ofp, buf_ptr, buf_len ? _IOFBF : _IOLBF, buf_len ? buf_len : BUFSIZ);
+#else
 	(void) setvbuf(ofp, buf_ptr, buf_len ? _IOFBF : _IOLBF, buf_len);
 #endif
+#endif
 #elif HAVE_SETBUFFER
 	(void) setbuffer(ofp, buf_ptr, (int) buf_len);
 #endif
diff -ur ncurses-5.9-orig/ncurses/tinfo/write_entry.c ncurses-5.9/ncurses/tinfo/write_entry.c
--- ncurses-5.9-orig/ncurses/tinfo/write_entry.c	2010-12-25 18:23:08 -0500
+++ ncurses-5.9/ncurses/tinfo/write_entry.c	2013-07-04 18:38:38 -0400
@@ -173,7 +173,7 @@
 
 	if ((rc = stat(path, &statbuf)) < 0) {
 	    rc = mkdir(path
-#if !defined(__MINGW32__)
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 		       ,0777
 #endif
 		);
diff -ur ncurses-5.9-orig/ncurses/trace/lib_trace.c ncurses-5.9/ncurses/trace/lib_trace.c
--- ncurses-5.9-orig/ncurses/trace/lib_trace.c	2010-12-18 20:21:19 -0500
+++ ncurses-5.9/ncurses/trace/lib_trace.c	2013-07-04 18:38:38 -0400
@@ -121,7 +121,11 @@
 	 * end of each line.  This is useful in case the program dies. 
 	 */
 #if HAVE_SETVBUF		/* ANSI */
+#ifdef _MSC_VER
+	(void) setvbuf(TraceFP, (char *) 0, _IOLBF, BUFSIZ);
+#else
 	(void) setvbuf(TraceFP, (char *) 0, _IOLBF, 0);
+#endif
 #elif HAVE_SETBUF /* POSIX */
 	(void) setbuffer(TraceFP, (char *) 0);
 #endif
@@ -184,7 +188,7 @@
 # if USE_WEAK_SYMBOLS
 	if ((pthread_self))
 # endif
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_MSC_VER)
 	    fprintf(TraceFP, "%#lx:", (long) (void *) pthread_self().p);
 #else
 	    fprintf(TraceFP, "%#lx:", (long) (void *) pthread_self());
diff -ur ncurses-5.9-orig/ncurses/tty/lib_twait.c ncurses-5.9/ncurses/tty/lib_twait.c
--- ncurses-5.9-orig/ncurses/tty/lib_twait.c	2010-12-25 18:43:58 -0500
+++ ncurses-5.9/ncurses/tty/lib_twait.c	2013-07-04 18:38:38 -0400
@@ -65,8 +65,12 @@
 #  include <sys/select.h>
 # endif
 #endif
-#ifdef __MINGW32__
-#  include <sys/time.h>
+#if defined(__MINGW32__) || defined(_MSC_VER)
+#  ifdef _MSC_VER
+#    include <winsock2.h>
+#  else
+#    include <sys/time.h>
+#  endif
 #endif
 #undef CUR
 
diff -ur ncurses-5.9-orig/ncurses/win32con/win_driver.c ncurses-5.9/ncurses/win32con/win_driver.c
--- ncurses-5.9-orig/ncurses/win32con/win_driver.c	2010-12-25 14:28:21 -0500
+++ ncurses-5.9/ncurses/win32con/win_driver.c	2013-07-04 18:38:38 -0400
@@ -138,7 +138,7 @@
 static BOOL
 con_write(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n)
 {
-    CHAR_INFO ci[n];
+    CHAR_INFO* ci = (CHAR_INFO*)_alloca(n * sizeof(CHAR_INFO*));
     COORD loc, siz;
     SMALL_RECT rec;
     int i;
@@ -197,7 +197,7 @@
 
     if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) {
 	int x;
-	chtype empty[Width];
+	chtype* empty = (chtype*)_alloca(Width * sizeof(chtype));
 
 	for (x = 0; x < Width; x++)
 	    empty[x] = ' ';
diff -ur ncurses-5.9-orig/panel/Makefile.in ncurses-5.9/panel/Makefile.in
--- ncurses-5.9-orig/panel/Makefile.in	2010-11-27 16:45:27 -0500
+++ ncurses-5.9/panel/Makefile.in	2013-07-04 18:38:38 -0400
@@ -85,7 +85,7 @@
 CPP		= @CPP@
 CFLAGS		= @CFLAGS@
 
-CPPFLAGS	= -I@top_srcdir@/ncurses -DHAVE_CONFIG_H @CPPFLAGS@
+CPPFLAGS	= -I@top_srcdir@/ncurses -DHAVE_CONFIG_H -DNCPANEL_DLL @CPPFLAGS@
 
 CCFLAGS		= $(CPPFLAGS) $(CFLAGS)
 
diff -ur ncurses-5.9-orig/panel/p_above.c ncurses-5.9/panel/p_above.c
--- ncurses-5.9-orig/panel/p_above.c	2010-01-23 16:22:15 -0500
+++ ncurses-5.9/panel/p_above.c	2013-07-04 18:38:38 -0400
@@ -39,7 +39,7 @@
 MODULE_ID("$Id: p_above.c,v 1.8 2010/01/23 21:22:15 tom Exp $")
 
 #if NCURSES_SP_FUNCS
-NCURSES_EXPORT(PANEL *)
+NCPANEL_EXPORT(PANEL *)
 ground_panel(SCREEN * sp)
 {
   T((T_CALLED("ground_panel(%p)"), sp));
@@ -62,7 +62,7 @@
 }
 #endif
 
-NCURSES_EXPORT(PANEL *)
+NCPANEL_EXPORT(PANEL *)
 panel_above(const PANEL * pan)
 {
   PANEL *result;
diff -ur ncurses-5.9-orig/panel/p_below.c ncurses-5.9/panel/p_below.c
--- ncurses-5.9-orig/panel/p_below.c	2010-01-23 16:22:15 -0500
+++ ncurses-5.9/panel/p_below.c	2013-07-04 18:38:38 -0400
@@ -39,7 +39,7 @@
 MODULE_ID("$Id: p_below.c,v 1.8 2010/01/23 21:22:15 tom Exp $")
 
 #if NCURSES_SP_FUNCS
-NCURSES_EXPORT(PANEL *)
+NCPANEL_EXPORT(PANEL *)
 ceiling_panel(SCREEN * sp)
 {
   T((T_CALLED("ceiling_panel(%p)"), sp));
@@ -60,7 +60,7 @@
 }
 #endif
 
-NCURSES_EXPORT(PANEL *)
+NCPANEL_EXPORT(PANEL *)
 panel_below(const PANEL * pan)
 {
   PANEL *result;
diff -ur ncurses-5.9-orig/panel/p_bottom.c ncurses-5.9/panel/p_bottom.c
--- ncurses-5.9-orig/panel/p_bottom.c	2010-01-23 16:22:16 -0500
+++ ncurses-5.9/panel/p_bottom.c	2013-07-04 18:38:38 -0400
@@ -39,7 +39,7 @@
 
 MODULE_ID("$Id: p_bottom.c,v 1.13 2010/01/23 21:22:16 tom Exp $")
 
-NCURSES_EXPORT(int)
+NCPANEL_EXPORT(int)
 bottom_panel(PANEL * pan)
 {
   int err = OK;
diff -ur ncurses-5.9-orig/panel/p_delete.c ncurses-5.9/panel/p_delete.c
--- ncurses-5.9-orig/panel/p_delete.c	2010-01-23 16:22:16 -0500
+++ ncurses-5.9/panel/p_delete.c	2013-07-04 18:38:38 -0400
@@ -39,7 +39,7 @@
 
 MODULE_ID("$Id: p_delete.c,v 1.10 2010/01/23 21:22:16 tom Exp $")
 
-NCURSES_EXPORT(int)
+NCPANEL_EXPORT(int)
 del_panel(PANEL * pan)
 {
   int err = OK;
diff -ur ncurses-5.9-orig/panel/p_hidden.c ncurses-5.9/panel/p_hidden.c
--- ncurses-5.9-orig/panel/p_hidden.c	2010-01-23 16:22:15 -0500
+++ ncurses-5.9/panel/p_hidden.c	2013-07-04 18:38:38 -0400
@@ -39,7 +39,7 @@
 
 MODULE_ID("$Id: p_hidden.c,v 1.9 2010/01/23 21:22:15 tom Exp $")
 
-NCURSES_EXPORT(int)
+NCPANEL_EXPORT(int)
 panel_hidden(const PANEL * pan)
 {
   int rc = ERR;
diff -ur ncurses-5.9-orig/panel/p_hide.c ncurses-5.9/panel/p_hide.c
--- ncurses-5.9-orig/panel/p_hide.c	2010-01-23 16:22:16 -0500
+++ ncurses-5.9/panel/p_hide.c	2013-07-04 18:38:38 -0400
@@ -38,7 +38,7 @@
 
 MODULE_ID("$Id: p_hide.c,v 1.11 2010/01/23 21:22:16 tom Exp $")
 
-NCURSES_EXPORT(int)
+NCPANEL_EXPORT(int)
 hide_panel(register PANEL * pan)
 {
   int err = ERR;
diff -ur ncurses-5.9-orig/panel/p_move.c ncurses-5.9/panel/p_move.c
--- ncurses-5.9-orig/panel/p_move.c	2010-01-23 16:22:15 -0500
+++ ncurses-5.9/panel/p_move.c	2013-07-04 18:38:38 -0400
@@ -39,7 +39,7 @@
 
 MODULE_ID("$Id: p_move.c,v 1.11 2010/01/23 21:22:15 tom Exp $")
 
-NCURSES_EXPORT(int)
+NCPANEL_EXPORT(int)
 move_panel(PANEL * pan, int starty, int startx)
 {
   int rc = ERR;
diff -ur ncurses-5.9-orig/panel/p_new.c ncurses-5.9/panel/p_new.c
--- ncurses-5.9-orig/panel/p_new.c	2010-01-23 16:22:16 -0500
+++ ncurses-5.9/panel/p_new.c	2013-07-04 18:38:38 -0400
@@ -88,7 +88,7 @@
   return _nc_stdscr_pseudo_panel;
 }
 
-NCURSES_EXPORT(PANEL *)
+NCPANEL_EXPORT(PANEL *)
 new_panel(WINDOW *win)
 {
   PANEL *pan = (PANEL *) 0;
diff -ur ncurses-5.9-orig/panel/p_replace.c ncurses-5.9/panel/p_replace.c
--- ncurses-5.9-orig/panel/p_replace.c	2010-01-23 16:22:16 -0500
+++ ncurses-5.9/panel/p_replace.c	2013-07-04 18:38:38 -0400
@@ -38,7 +38,7 @@
 
 MODULE_ID("$Id: p_replace.c,v 1.11 2010/01/23 21:22:16 tom Exp $")
 
-NCURSES_EXPORT(int)
+NCPANEL_EXPORT(int)
 replace_panel(PANEL * pan, WINDOW *win)
 {
   int rc = ERR;
diff -ur ncurses-5.9-orig/panel/p_show.c ncurses-5.9/panel/p_show.c
--- ncurses-5.9-orig/panel/p_show.c	2010-01-23 16:22:16 -0500
+++ ncurses-5.9/panel/p_show.c	2013-07-04 18:38:38 -0400
@@ -38,7 +38,7 @@
 
 MODULE_ID("$Id: p_show.c,v 1.13 2010/01/23 21:22:16 tom Exp $")
 
-NCURSES_EXPORT(int)
+NCPANEL_EXPORT(int)
 show_panel(PANEL * pan)
 {
   int err = ERR;
diff -ur ncurses-5.9-orig/panel/p_top.c ncurses-5.9/panel/p_top.c
--- ncurses-5.9-orig/panel/p_top.c	2010-01-23 16:22:16 -0500
+++ ncurses-5.9/panel/p_top.c	2013-07-04 18:38:39 -0400
@@ -38,7 +38,7 @@
 
 MODULE_ID("$Id: p_top.c,v 1.6 2010/01/23 21:22:16 tom Exp $")
 
-NCURSES_EXPORT(int)
+NCPANEL_EXPORT(int)
 top_panel(PANEL * pan)
 {
   T((T_CALLED("top_panel(%p)"), (void *)pan));
diff -ur ncurses-5.9-orig/panel/p_update.c ncurses-5.9/panel/p_update.c
--- ncurses-5.9-orig/panel/p_update.c	2010-01-23 16:22:16 -0500
+++ ncurses-5.9/panel/p_update.c	2013-07-04 18:38:39 -0400
@@ -39,7 +39,7 @@
 
 MODULE_ID("$Id: p_update.c,v 1.11 2010/01/23 21:22:16 tom Exp $")
 
-NCURSES_EXPORT(void)
+NCPANEL_EXPORT(void)
 NCURSES_SP_NAME(update_panels) (NCURSES_SP_DCL0)
 {
   PANEL *pan;
@@ -70,7 +70,7 @@
 }
 
 #if NCURSES_SP_FUNCS
-NCURSES_EXPORT(void)
+NCPANEL_EXPORT(void)
 update_panels(void)
 {
   NCURSES_SP_NAME(update_panels) (CURRENT_SCREEN);
diff -ur ncurses-5.9-orig/panel/p_user.c ncurses-5.9/panel/p_user.c
--- ncurses-5.9-orig/panel/p_user.c	2010-01-23 18:18:35 -0500
+++ ncurses-5.9/panel/p_user.c	2013-07-04 18:38:39 -0400
@@ -38,7 +38,7 @@
 
 MODULE_ID("$Id: p_user.c,v 1.8 2010/01/23 23:18:35 tom Exp $")
 
-NCURSES_EXPORT(int)
+NCPANEL_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));
@@ -48,7 +48,7 @@
   returnCode(OK);
 }
 
-NCURSES_EXPORT(NCURSES_CONST void *)
+NCPANEL_EXPORT(NCURSES_CONST void *)
 panel_userptr(const PANEL * pan)
 {
   T((T_CALLED("panel_userptr(%p)"), (const void *)pan));
diff -ur ncurses-5.9-orig/panel/p_win.c ncurses-5.9/panel/p_win.c
--- ncurses-5.9-orig/panel/p_win.c	2010-01-23 16:22:15 -0500
+++ ncurses-5.9/panel/p_win.c	2013-07-04 18:38:39 -0400
@@ -38,7 +38,7 @@
 
 MODULE_ID("$Id: p_win.c,v 1.6 2010/01/23 21:22:15 tom Exp $")
 
-NCURSES_EXPORT(WINDOW *)
+NCPANEL_EXPORT(WINDOW *)
 panel_window(const PANEL * pan)
 {
   T((T_CALLED("panel_window(%p)"), (const void *)pan));
diff -ur ncurses-5.9-orig/panel/panel.c ncurses-5.9/panel/panel.c
--- ncurses-5.9-orig/panel/panel.c	2010-01-23 16:22:16 -0500
+++ ncurses-5.9/panel/panel.c	2013-07-04 18:38:39 -0400
@@ -42,7 +42,7 @@
 	_nc_retrace_panel (pan)
 --------------------------------------------------------------------------*/
 #ifdef TRACE
-NCURSES_EXPORT(PANEL *)
+NCPANEL_EXPORT(PANEL *)
 _nc_retrace_panel(PANEL * pan)
 {
   T((T_RETURN("%p"), (void *)pan));
@@ -55,7 +55,7 @@
 --------------------------------------------------------------------------*/
 #ifdef TRACE
 #ifndef TRACE_TXT
-NCURSES_EXPORT(const char *)
+NCPANEL_EXPORT(const char *)
 _nc_my_visbuf(const void *ptr)
 {
   char temp[32];
@@ -73,7 +73,7 @@
 	dPanel(text,pan)
 --------------------------------------------------------------------------*/
 #ifdef TRACE
-NCURSES_EXPORT(void)
+NCPANEL_EXPORT(void)
 _nc_dPanel(const char *text, const PANEL * pan)
 {
   _tracef("%s id=%s b=%s a=%s y=%d x=%d",
@@ -88,7 +88,7 @@
 	dStack(fmt,num,pan)
 --------------------------------------------------------------------------*/
 #ifdef TRACE
-NCURSES_EXPORT(void)
+NCPANEL_EXPORT(void)
 _nc_dStack(const char *fmt, int num, const PANEL * pan)
 {
   char s80[80];
@@ -114,7 +114,7 @@
 	Wnoutrefresh(pan) - debugging hook for wnoutrefresh
 --------------------------------------------------------------------------*/
 #ifdef TRACE
-NCURSES_EXPORT(void)
+NCPANEL_EXPORT(void)
 _nc_Wnoutrefresh(const PANEL * pan)
 {
   dPanel("wnoutrefresh", pan);
@@ -126,7 +126,7 @@
 	Touchpan(pan)
 --------------------------------------------------------------------------*/
 #ifdef TRACE
-NCURSES_EXPORT(void)
+NCPANEL_EXPORT(void)
 _nc_Touchpan(const PANEL * pan)
 {
   dPanel("Touchpan", pan);
@@ -138,7 +138,7 @@
 	Touchline(pan,start,count)
 --------------------------------------------------------------------------*/
 #ifdef TRACE
-NCURSES_EXPORT(void)
+NCPANEL_EXPORT(void)
 _nc_Touchline(const PANEL * pan, int start, int count)
 {
   char s80[80];
diff -ur ncurses-5.9-orig/panel/panel.h ncurses-5.9/panel/panel.h
--- ncurses-5.9-orig/panel/panel.h	2009-04-11 15:50:40 -0400
+++ ncurses-5.9/panel/panel.h	2013-07-04 18:38:39 -0400
@@ -53,27 +53,27 @@
 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 *);
+extern NCPANEL_EXPORT(WINDOW*) panel_window (const PANEL *);
+extern NCPANEL_EXPORT(void)    update_panels (void);
+extern NCPANEL_EXPORT(int)     hide_panel (PANEL *);
+extern NCPANEL_EXPORT(int)     show_panel (PANEL *);
+extern NCPANEL_EXPORT(int)     del_panel (PANEL *);
+extern NCPANEL_EXPORT(int)     top_panel (PANEL *);
+extern NCPANEL_EXPORT(int)     bottom_panel (PANEL *);
+extern NCPANEL_EXPORT(PANEL*)  new_panel (WINDOW *);
+extern NCPANEL_EXPORT(PANEL*)  panel_above (const PANEL *);
+extern NCPANEL_EXPORT(PANEL*)  panel_below (const PANEL *);
+extern NCPANEL_EXPORT(int)     set_panel_userptr (PANEL *, NCURSES_CONST void *);
+extern NCPANEL_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *);
+extern NCPANEL_EXPORT(int)     move_panel (PANEL *, int, int);
+extern NCPANEL_EXPORT(int)     replace_panel (PANEL *,WINDOW *);
+extern NCPANEL_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 NCPANEL_EXPORT(PANEL *) ground_panel(SCREEN *);
+extern NCPANEL_EXPORT(PANEL *) ceiling_panel(SCREEN *);
 
-extern NCURSES_EXPORT(void)    NCURSES_SP_NAME(update_panels) (SCREEN*);
+extern NCPANEL_EXPORT(void)    NCURSES_SP_NAME(update_panels) (SCREEN*);
 #endif
 
 #if	defined(__cplusplus)
diff -ur ncurses-5.9-orig/panel/panel.priv.h ncurses-5.9/panel/panel.priv.h
--- ncurses-5.9-orig/panel/panel.priv.h	2009-04-11 16:33:55 -0400
+++ ncurses-5.9/panel/panel.priv.h	2013-07-04 18:38:39 -0400
@@ -53,7 +53,7 @@
 
 
 #ifdef TRACE
-   extern NCURSES_EXPORT(const char *) _nc_my_visbuf (const void *);
+   extern NCPANEL_EXPORT(const char *) _nc_my_visbuf (const void *);
 #  ifdef TRACE_TXT
 #    define USER_PTR(ptr) _nc_visbuf((const char *)ptr)
 #  else
@@ -62,12 +62,12 @@
 
 #  define returnPanel(code)	TRACE_RETURN(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 NCPANEL_EXPORT(PANEL *) _nc_retrace_panel (PANEL *);
+   extern NCPANEL_EXPORT(void) _nc_dPanel (const char*, const PANEL*);
+   extern NCPANEL_EXPORT(void) _nc_dStack (const char*, int, const PANEL*);
+   extern NCPANEL_EXPORT(void) _nc_Wnoutrefresh (const PANEL*);
+   extern NCPANEL_EXPORT(void) _nc_Touchpan (const PANEL*);
+   extern NCPANEL_EXPORT(void) _nc_Touchline (const PANEL*, int, int);
 
 #  define dBug(x) _tracef x
 #  define dPanel(text,pan) _nc_dPanel(text,pan)
@@ -208,7 +208,7 @@
 
 #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 NCPANEL_EXPORT(void) NCURSES_SP_NAME(_nc_update_panels)(SCREEN*);
 #endif
 
 #endif /* NCURSES_PANEL_PRIV_H */
diff -ur ncurses-5.9-orig/progs/Makefile.in ncurses-5.9/progs/Makefile.in
--- ncurses-5.9-orig/progs/Makefile.in	2010-11-27 16:45:27 -0500
+++ ncurses-5.9/progs/Makefile.in	2013-07-04 18:38:39 -0400
@@ -113,10 +113,10 @@
 
 LDFLAGS_DEFAULT	= $(LDFLAGS_@DFT_UPR_MODEL@)
 
-LIBS_TIC	= @LDFLAGS_STATIC@ @TICS_ARGS@ @TINFO_ARGS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@
+LIBS_TIC	= @LDFLAGS_STATIC@ @TICS_ARGS@ @TINFO_ARGS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@ -lgetopt
 LDFLAGS_TIC	= $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TIC)
 
-LIBS_TINFO	= @LDFLAGS_STATIC@ @TINFO_ARGS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@
+LIBS_TINFO	= @LDFLAGS_STATIC@ @TINFO_ARGS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@ -lgetopt
 LDFLAGS_TINFO	= $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO)
 
 LINT		= @LINT@
diff -ur ncurses-5.9-orig/progs/progs.priv.h ncurses-5.9/progs/progs.priv.h
--- ncurses-5.9-orig/progs/progs.priv.h	2008-08-03 13:43:05 -0400
+++ ncurses-5.9/progs/progs.priv.h	2013-07-04 18:38:39 -0400
@@ -148,8 +148,14 @@
 #endif
 
 #ifndef X_OK
+#ifdef _MSC_VER
+#define X_OK    0		/* MSVC does not support X_OK and generate invalid
+                                 * parameter exception if used as argument to "access"
+                                 * function. */
+#else
 #define	X_OK	1		/* Test for executable.  */
 #endif
+#endif
 
 #ifndef F_OK
 #define	F_OK	0		/* Test for existence.  */
diff -ur ncurses-5.9-orig/test/Makefile.in ncurses-5.9/test/Makefile.in
--- ncurses-5.9-orig/test/Makefile.in	2010-11-28 11:39:40 -0500
+++ ncurses-5.9/test/Makefile.in	2013-07-04 18:38:39 -0400
@@ -105,7 +105,7 @@
 TEST_ARGS	= @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@ 
 
 # use these for linking with all of the libraries
-LIBS_DEFAULT	= $(TEST_ARGS) @LIBS@ $(TEST_LIBS) $(MATH_LIB)
+LIBS_DEFAULT	= $(TEST_ARGS) @LIBS@ $(TEST_LIBS) $(MATH_LIB) -lgetopt
 LDFLAGS_DEFAULT	= $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_DEFAULT)
 
 # use these for linking with the (n)curses library and possibly pthreads
@@ -113,11 +113,11 @@
 LDFLAGS_THREADS	= $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_THREADS)
 
 # use these for linking with the (n)curses library
-LIBS_CURSES	= `echo "$(TEST_ARGS) @LIBS@" | sed -e 's/-lform.*-lpanel[^ ]*//'` $(TEST_LIBS) $(MATH_LIB)
+LIBS_CURSES	= `echo "$(TEST_ARGS) @LIBS@" | sed -e 's/-lform.*-lpanel[^ ]*//'` $(TEST_LIBS) $(MATH_LIB) -lgetopt
 LDFLAGS_CURSES	= $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_CURSES)
 
 # use these for linking with the tinfo library if we have it, or curses library if not
-LIBS_TINFO	= @LDFLAGS_STATIC@ @TINFO_ARGS@ @LDFLAGS_SHARED@ @LIBS@ $(TEST_LIBS) $(MATH_LIB)
+LIBS_TINFO	= @LDFLAGS_STATIC@ @TINFO_ARGS@ @LDFLAGS_SHARED@ @LIBS@ $(TEST_LIBS) $(MATH_LIB) -lgetopt
 LDFLAGS_TINFO	= $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO)
 
 LINT		= @LINT@
diff -ur ncurses-5.9-orig/test/dots.c ncurses-5.9/test/dots.c
--- ncurses-5.9-orig/test/dots.c	2010-11-13 20:00:02 -0500
+++ ncurses-5.9/test/dots.c	2013-07-04 18:38:39 -0400
@@ -42,6 +42,10 @@
 
 #define valid(s) ((s != 0) && s != (char *)-1)
 
+#ifdef _MSC_VER
+#  define STDOUT_FILENO 1
+#endif
+
 static bool interrupted = FALSE;
 static long total_chars = 0;
 static time_t started;
diff -ur ncurses-5.9-orig/test/dots_mvcur.c ncurses-5.9/test/dots_mvcur.c
--- ncurses-5.9-orig/test/dots_mvcur.c	2010-11-13 20:00:44 -0500
+++ ncurses-5.9/test/dots_mvcur.c	2013-07-04 18:38:39 -0400
@@ -42,6 +42,10 @@
 
 #define valid(s) ((s != 0) && s != (char *)-1)
 
+#ifdef _MSC_VER
+#  define STDOUT_FILENO 1
+#endif
+
 static bool interrupted = FALSE;
 static long total_chars = 0;
 static time_t started;
diff -ur ncurses-5.9-orig/test/ncurses.c ncurses-5.9/test/ncurses.c
--- ncurses-5.9-orig/test/ncurses.c	2011-01-22 14:48:33 -0500
+++ ncurses-5.9/test/ncurses.c	2013-07-04 18:38:39 -0400
@@ -487,7 +487,7 @@
 	addstr("Shelling out...");
     def_prog_mode();
     endwin();
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_MSC_VER)
     system("cmd.exe");
 #else
     system("sh");
diff -ur ncurses-5.9-orig/test/railroad.c ncurses-5.9/test/railroad.c
--- ncurses-5.9-orig/test/railroad.c	2009-10-24 17:37:56 -0400
+++ ncurses-5.9/test/railroad.c	2013-07-04 18:38:39 -0400
@@ -36,6 +36,10 @@
 #define USE_TINFO
 #include <test.priv.h>
 
+#ifdef _MSC_VER
+#  define STDOUT_FILENO 1
+#endif
+
 #if HAVE_TGETENT
 
 static char *wipeit;
diff -ur ncurses-5.9-orig/test/rain.c ncurses-5.9/test/rain.c
--- ncurses-5.9-orig/test/rain.c	2010-11-13 15:11:46 -0500
+++ ncurses-5.9/test/rain.c	2013-07-04 18:38:39 -0400
@@ -222,7 +222,7 @@
      * Find myself in the list of threads so we can count the number of loops.
      */
     for (mystats = 0; mystats < MAX_THREADS; ++mystats) {
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_MSC_VER)
 	if (drop_threads[mystats].myself.p == pthread_self().p)
 #else
 	if (drop_threads[mystats].myself == pthread_self())
diff -ur ncurses-5.9-orig/test/test.priv.h ncurses-5.9/test/test.priv.h
--- ncurses-5.9-orig/test/test.priv.h	2011-03-22 05:15:45 -0400
+++ ncurses-5.9/test/test.priv.h	2013-07-04 18:38:39 -0400
@@ -609,7 +609,7 @@
 #define EXIT_FAILURE 1
 #endif
 
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_MSC_VER)
 #include <nc_mingw.h>
 /* conflicts in test/firstlast.c */
 #undef large
@@ -641,12 +641,24 @@
 
 #define VT_ACSC "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"
 
+#ifdef _MSC_VER
+#define CATCHALL(handler) \
+	do { \
+		/* These are the only signal allowed by MSVC. */ \
+		signal(SIGINT, handler); \
+		signal(SIGILL, handler); \
+		signal(SIGFPE, handler); \
+		signal(SIGSEGV, handler); \
+		signal(SIGABRT, handler); \
+        } while (0)
+#else
 #define CATCHALL(handler) { \
 		int nsig; \
 		for (nsig = SIGHUP; nsig < SIGTERM; ++nsig) \
 		    if (nsig != SIGKILL) \
 			signal(nsig, handler); \
 	    }
+#endif
 
 /*
  * Workaround for clean(er) compile with Solaris's legacy curses.
diff -ur ncurses-5.9-orig/test/view.c ncurses-5.9/test/view.c
--- ncurses-5.9-orig/test/view.c	2010-11-13 20:06:02 -0500
+++ ncurses-5.9/test/view.c	2013-07-04 18:38:39 -0400
@@ -62,7 +62,7 @@
 #if HAVE_TERMIOS_H
 # include <termios.h>
 #else
-#if !defined(__MINGW32__)
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 # include <sgtty.h>
 #endif
 #endif
