public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Build libstdc++ as a DLL on Windows, updated for new autotools.
@ 2009-08-28 23:21 Dave Korn
  2009-08-31 21:43 ` Dave Korn
  2009-09-03  4:06 ` Dave Korn
  0 siblings, 2 replies; 4+ messages in thread
From: Dave Korn @ 2009-08-28 23:21 UTC (permalink / raw)
  To: GCC Patches, libstdc++, Benjamin Kosnik

[-- Attachment #1: Type: text/plain, Size: 5784 bytes --]

[ refs:   The original series of patches at
  [0/4]  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01042.html
  [1/4]  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01044.html
  [2/4]  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01046.html
  [3/4]  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01047.html
  [4/4]  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01048.html
 and the tweaked respin at
         http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01631.html
 and the updated tweaked respin at
         http://gcc.gnu.org/ml/gcc-patches/2009-08/msg00877.html  ]


    Hi all,

  The recent autotools updates necessitated a minor tweak to my patch to build
libstdc++ DLLs on Windows.  While I was doing that, I realised that the linker
specs need to exclude doing the --wrap trick (see earlier posts) when
statically linking libstdc++, so I've updated it to do that(*), and I've also
updated it to take advantage of the new -bindir option just added to
libtool(**).  It's already received build and w32 maintainer approval, and Ben
(Cc'd) has offered to review the C++ side, which is the last bit that needs it.

gcc/ChangeLog:

	* configure.ac (USE_CYGWIN_LIBSTDCXX_WRAPPERS): Define to reflect
	status of AC_CHECK_FUNC for Cygwin DLL libstdc++ support wrappers.
	* configure: Regenerate.
	* config.in: Regenerate.

	* config/i386/cygwin.h (CXX_WRAP_SPEC_LIST): Define list of --wrap
	options for Cygwin DLL libstdc++ support wrappers.
	(CXX_WRAP_SPEC_OPT): Define spec to use wrappers or not by default
	according to status of USE_CYGWIN_LIBSTDCXX_WRAPPERS.
	(LINK_SPEC): Include CXX_WRAP_SPEC_OPT.
	* config/i386/cygming.opt (muse-libstdc-wrappers): New option for
	Cygwin targets. Update copyright year.

libstdc++-v3/ChangeLog:

	* src/Makefile.am (libstdc___la_LDFLAGS): Add -no-undefined and
	-bindir switches.
	* src/Makefile.in: Regenerate.

	* config/os/newlib/os_defines.h (_GLIBCXX_IMPORT): Define to
	dllimport when indicated by _GLIBCXX_DLL.
	* config/os/mingw32/os_defines.h (_GLIBCXX_IMPORT): Likewise.
	* include/bits/c++config (_GLIBCXX_IMPORT): Add empty definition
	for non-dllimport targets.

	* include/std/iostream (cin): Annotate with _GLIBCXX_IMPORT.
	(cout, cerr, clog): Likewise.
	* include/std/stdexcept (class logic_error, domain_error,
	invalid_argument, length_error, out_of_range, runtime_error,
	range_error, underflow_error): Likewise.
	* include/ext/concurrence.h (class __concurrence_lock_error,
	__concurrence_unlock_error): Likewise.
	* include/bits/locale_classes.tcc (template class collate<char>,
	collate_byname<char>, collate<wchar_t>,
	collate_byname<wchar_t>): Likewise.
	* include/bits/locale_facets.tcc (template class numpunct<char>,
	numpunct_byname<char>, num_get<char>, num_put<char>,
	ctype_byname<char>, numpunct<wchar_t>, numpunct_byname<wchar_t>,
	num_get<wchar_t>, num_put<wchar_t>, ctype_byname<wchar_t>): Likewise.
	* include/bits/locale_classes.h (class locale, facet, id, _Impl,
	locale::facet, locale::id, locale::_Impl): Likewise.
	* include/bits/locale_facets.h (template class ctype<char>,
	ctype<wchar_t>): Likewise.
	* include/bits/basic_ios.tcc (template class basic_ios<char>,
	basic_ios<wchar_t>): Likewise.
	* include/bits/ios_base.h (class ios_base, failure, Init): Likewise.
	* include/bits/istream.tcc (template class basic_istream<char>,
	basic_iostream<char>, basic_istream<wchar_t>,
	basic_iostream<wchar_t>): Likewise.
	* include/bits/codecvt.h (template class codecvt_byname<char, char,
	mbstate_t>, codecvt_byname<wchar_t, char, mbstate_t>): Likewise.
	* include/bits/ostream.tcc (template class basic_ostream<char>,
	basic_ostream<wchar_t>): Likewise.
	* include/bits/sstream.tcc (template class basic_stringbuf<char>,
	basic_istringstream<char>, basic_ostringstream<char>,
	basic_stringstream<char>, basic_stringbuf<wchar_t>,
	basic_istringstream<wchar_t>, basic_ostringstream<wchar_t>,
	basic_stringstream<wchar_t>): Likewise.
	* include/bits/basic_string.tcc (template class basic_string<char>,
	basic_string<wchar_t>, related overloaded operator<<, operator>>,
	getline): Likewise.
	* include/bits/locale_facets_nonio.tcc (template class
	moneypunct<char, false>, moneypunct<char, true>,
	moneypunct_byname<char, false>, moneypunct_byname<char, true>,
	money_get<char>, money_put<char>, __timepunct<char>, time_put<char>,
	time_put_byname<char>, time_get<char>, time_get_byname<char>,
	messages<char>, messages_byname<char>, moneypunct<wchar_t, false>,
	moneypunct<wchar_t, true>, moneypunct_byname<wchar_t, false>,
	moneypunct_byname<wchar_t, true>, money_get<wchar_t>,
	money_put<wchar_t>, __timepunct<wchar_t>, time_put<wchar_t>,
	time_put_byname<wchar_t>, time_get<wchar_t>, time_get_byname<wchar_t>,
	messages<wchar_t>, messages_byname<wchar_t>): Likewise.
	* include/bits/streambuf.tcc (template class basic_streambuf<char>,
	basic_streambuf<wchar_t>): Likewise.
	* include/bits/fstream.tcc (template class basic_filebuf<char>,
	basic_ifstream<char>, basic_ofstream<char>, basic_fstream<char>,
	basic_filebuf<wchar_t>, basic_ifstream<wchar_t>,
	basic_ofstream<wchar_t>, basic_fstream<wchar_t>): Likewise.
	* include/backward/strstream (class strstreambuf, istrstream,
	ostrstream, strstream): Likewise.
	* libsupc++/typeinfo (class type_info, bad_cast,
	bad_typeid): Likewise.
	* libsupc++/exception (class exception, bad_exception): Likewise.
	* libsupc++/new (class bad_alloc): Likewise.

	* testsuite/lib/libstdc++.exp (proc libstdc++_init): Adjust
	DEFAULT_CXXFLAGS and ld_library_path_tmp for Cygwin.

  Bootstrapped on i686-pc-cygwin, tests still running.  Assuming no
regressions (as seen on prior testruns), OK for HEAD?

    cheers,
      DaveK
-- 
(*)  - but see http://gcc.gnu.org/ml/gcc-patches/2009-08/msg01569.html
(**) - http://gcc.gnu.org/ml/gcc-patches/2009-08/msg01073.html


[-- Attachment #2: libstdc-dll-respun-newtools.diff --]
[-- Type: text/x-c, Size: 35225 bytes --]

Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 151124)
+++ gcc/configure.ac	(working copy)
@@ -2971,6 +2971,19 @@ changequote(,)dnl
   i[34567]86-*-* | x86_64-*-*)
 changequote([,])dnl
     case $target_os in
+      cygwin*)
+	# Full C++ conformance when using a shared libstdc++-v3 requires some
+	# support from the Cygwin DLL, which in more recent versions exports
+	# wrappers to aid in interposing and redirecting operators new, delete,
+	# etc., as per n2800 #17.6.4.6 [replacement.functions].  Check if we
+	# are configuring for a version of Cygwin that exports the wrappers.
+	AC_CHECK_FUNC([__wrap__Znaj],[gcc_ac_cygwin_dll_wrappers=yes],[gcc_ac_cygwin_dll_wrappers=no])
+	AC_DEFINE_UNQUOTED(USE_CYGWIN_LIBSTDCXX_WRAPPERS,
+	  [`if test $gcc_ac_cygwin_dll_wrappers = yes; then echo 1; else echo 0; fi`],
+	  [Define if you want to generate code by default that assumes that the
+	   Cygwin DLL exports wrappers to support libstdc++ function replacement.])
+    esac
+    case $target_os in
       cygwin* | pe | mingw32*)
 	# Recent binutils allows the three-operand form of ".comm" on PE.  This
 	# definition is used unconditionally to initialise the default state of
Index: gcc/config/i386/cygwin.h
===================================================================
--- gcc/config/i386/cygwin.h	(revision 151124)
+++ gcc/config/i386/cygwin.h	(working copy)
@@ -85,9 +85,39 @@ along with GCC; see the file COPYING3.  If not see
   %{mwindows:-lgdi32 -lcomdlg32} \
   -luser32 -lkernel32 -ladvapi32 -lshell32"
 
+/* To implement C++ function replacement we always wrap the cxx
+   malloc-like operators.  See N2800 #17.6.4.6 [replacement.functions] */
+#define CXX_WRAP_SPEC_LIST "%{!static: %{!static-libstdc++: \
+  --wrap _Znwj \
+  --wrap _Znaj \
+  --wrap _ZdlPv \
+  --wrap _ZdaPv \
+  --wrap _ZnwjRKSt9nothrow_t \
+  --wrap _ZnajRKSt9nothrow_t \
+  --wrap _ZdlPvRKSt9nothrow_t \
+  --wrap _ZdaPvRKSt9nothrow_t \
+  }}"
+
+#if defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)
+
+#if USE_CYGWIN_LIBSTDCXX_WRAPPERS
+/* Default on, only explict -mno disables.  */
+#define CXX_WRAP_SPEC_OPT "!mno-use-libstdc-wrappers"
+#else
+/* Default off, only explict -m enables.  */
+#define CXX_WRAP_SPEC_OPT "muse-libstdc-wrappers"
+#endif
+
+#else /* !defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)  */
+
+#define CXX_WRAP_SPEC_OPT ""
+
+#endif /* ?defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS) */
+
 #define LINK_SPEC "\
   %{mwindows:--subsystem windows} \
   %{mconsole:--subsystem console} \
+  %{" CXX_WRAP_SPEC_OPT ":" CXX_WRAP_SPEC_LIST "} \
   %{shared: %{mdll: %eshared and mdll are not compatible}} \
   %{shared: --shared} %{mdll:--dll} \
   %{static:-Bstatic} %{!static:-Bdynamic} \
Index: gcc/config/i386/cygming.opt
===================================================================
--- gcc/config/i386/cygming.opt	(revision 151124)
+++ gcc/config/i386/cygming.opt	(working copy)
@@ -1,6 +1,6 @@
 ; Cygwin- and MinGW-specific options.
 
-; Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+; Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
 ;
 ; This file is part of GCC.
 ;
@@ -49,3 +49,7 @@ Create GUI application
 mpe-aligned-commons
 Target Var(use_pe_aligned_common) Init(HAVE_GAS_ALIGNED_COMM)
 Use the GNU extension to the PE format for aligned common data
+
+muse-libstdc-wrappers
+Target C++ Condition({defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)})
+Compile code that relies on Cygwin DLL wrappers to support C++ operator new/delete replacement
Index: libstdc++-v3/src/Makefile.am
===================================================================
--- libstdc++-v3/src/Makefile.am	(revision 151124)
+++ libstdc++-v3/src/Makefile.am	(working copy)
@@ -207,7 +207,8 @@ libstdc___la_DEPENDENCIES = \
 	$(top_builddir)/libsupc++/libsupc++convenience.la
 
 libstdc___la_LDFLAGS = \
-	-version-info $(libtool_VERSION) ${version_arg} -lm 
+	-version-info $(libtool_VERSION) ${version_arg} -lm \
+	-no-undefined -bindir $(bindir)
 
 # Use special rules for the deprecated source files so that they find
 # deprecated include files.
Index: libstdc++-v3/include/std/iostream
===================================================================
--- libstdc++-v3/include/std/iostream	(revision 151124)
+++ libstdc++-v3/include/std/iostream	(working copy)
@@ -55,16 +55,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  termination.  For more information, see the HOWTO linked to above.
   */
   //@{
-  extern istream cin;		///< Linked to standard input
-  extern ostream cout;		///< Linked to standard output
-  extern ostream cerr;		///< Linked to standard error (unbuffered)
-  extern ostream clog;		///< Linked to standard error (buffered)
+  extern _GLIBCXX_IMPORT istream cin;		///< Linked to standard input
+  extern _GLIBCXX_IMPORT ostream cout;		///< Linked to standard output
+  extern _GLIBCXX_IMPORT ostream cerr;		///< Linked to standard error (unbuffered)
+  extern _GLIBCXX_IMPORT ostream clog;		///< Linked to standard error (buffered)
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern wistream wcin;		///< Linked to standard input
-  extern wostream wcout;	///< Linked to standard output
-  extern wostream wcerr;	///< Linked to standard error (unbuffered)
-  extern wostream wclog;	///< Linked to standard error (buffered)
+  extern _GLIBCXX_IMPORT wistream wcin;		///< Linked to standard input
+  extern _GLIBCXX_IMPORT wostream wcout;	///< Linked to standard output
+  extern _GLIBCXX_IMPORT wostream wcerr;	///< Linked to standard error (unbuffered)
+  extern _GLIBCXX_IMPORT wostream wclog;	///< Linked to standard error (buffered)
 #endif
   //@}
 
Index: libstdc++-v3/include/std/stdexcept
===================================================================
--- libstdc++-v3/include/std/stdexcept	(revision 151124)
+++ libstdc++-v3/include/std/stdexcept	(working copy)
@@ -50,7 +50,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  program runs (e.g., violations of class invariants).
    *  @brief One of two subclasses of exception.
    */
-  class logic_error : public exception 
+  class _GLIBCXX_IMPORT logic_error : public exception
   {
     string _M_msg;
 
@@ -70,14 +70,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   /** Thrown by the library, or by you, to report domain errors (domain in
    *  the mathematical sense).  */
-  class domain_error : public logic_error 
+  class _GLIBCXX_IMPORT domain_error : public logic_error
   {
   public:
     explicit domain_error(const string& __arg);
   };
 
   /** Thrown to report invalid arguments to functions.  */
-  class invalid_argument : public logic_error 
+  class _GLIBCXX_IMPORT invalid_argument : public logic_error
   {
   public:
     explicit invalid_argument(const string& __arg);
@@ -85,7 +85,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   /** Thrown when an object is constructed that would exceed its maximum
    *  permitted size (e.g., a basic_string instance).  */
-  class length_error : public logic_error 
+  class _GLIBCXX_IMPORT length_error : public logic_error
   {
   public:
     explicit length_error(const string& __arg);
@@ -93,7 +93,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   /** This represents an argument whose value is not within the expected
    *  range (e.g., boundary checks in basic_string).  */
-  class out_of_range : public logic_error 
+  class _GLIBCXX_IMPORT out_of_range : public logic_error
   {
   public:
     explicit out_of_range(const string& __arg);
@@ -104,7 +104,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  the program executes.
    *  @brief One of two subclasses of exception.
    */
-  class runtime_error : public exception 
+  class _GLIBCXX_IMPORT runtime_error : public exception
   {
     string _M_msg;
 
@@ -123,7 +123,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   };
 
   /** Thrown to indicate range errors in internal computations.  */
-  class range_error : public runtime_error 
+  class _GLIBCXX_IMPORT range_error : public runtime_error
   {
   public:
     explicit range_error(const string& __arg);
@@ -137,7 +137,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   };
 
   /** Thrown to indicate arithmetic underflow.  */
-  class underflow_error : public runtime_error 
+  class _GLIBCXX_IMPORT underflow_error : public runtime_error
   {
   public:
     explicit underflow_error(const string& __arg);
Index: libstdc++-v3/include/ext/concurrence.h
===================================================================
--- libstdc++-v3/include/ext/concurrence.h	(revision 151124)
+++ libstdc++-v3/include/ext/concurrence.h	(working copy)
@@ -60,7 +60,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 
   // NB: As this is used in libsupc++, need to only depend on
   // exception. No stdexception classes, no use of std::string.
-  class __concurrence_lock_error : public std::exception
+  class _GLIBCXX_IMPORT __concurrence_lock_error : public std::exception
   {
   public:
     virtual char const*
@@ -68,7 +68,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
     { return "__gnu_cxx::__concurrence_lock_error"; }
   };
 
-  class __concurrence_unlock_error : public std::exception
+  class _GLIBCXX_IMPORT __concurrence_unlock_error : public std::exception
   {
   public:
     virtual char const*
Index: libstdc++-v3/include/bits/locale_classes.tcc
===================================================================
--- libstdc++-v3/include/bits/locale_classes.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/locale_classes.tcc	(working copy)
@@ -241,8 +241,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class collate<char>;
-  extern template class collate_byname<char>;
+  extern template class _GLIBCXX_IMPORT collate<char>;
+  extern template class _GLIBCXX_IMPORT collate_byname<char>;
 
   extern template
     const collate<char>&
@@ -253,8 +253,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     has_facet<collate<char> >(const locale&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class collate<wchar_t>;
-  extern template class collate_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT collate<wchar_t>;
+  extern template class _GLIBCXX_IMPORT collate_byname<wchar_t>;
 
   extern template
     const collate<wchar_t>&
Index: libstdc++-v3/include/bits/locale_facets.tcc
===================================================================
--- libstdc++-v3/include/bits/locale_facets.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/locale_facets.tcc	(working copy)
@@ -1276,11 +1276,11 @@ _GLIBCXX_END_LDBL_NAMESPACE
   // which are defined via explicit instantiations elsewhere.
   // NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class numpunct<char>;
-  extern template class numpunct_byname<char>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE num_get<char>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE num_put<char>;
-  extern template class ctype_byname<char>;
+  extern template class _GLIBCXX_IMPORT numpunct<char>;
+  extern template class _GLIBCXX_IMPORT numpunct_byname<char>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE num_get<char>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE num_put<char>;
+  extern template class _GLIBCXX_IMPORT ctype_byname<char>;
 
   extern template
     const ctype<char>&
@@ -1315,11 +1315,11 @@ _GLIBCXX_END_LDBL_NAMESPACE
     has_facet<num_get<char> >(const locale&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class numpunct<wchar_t>;
-  extern template class numpunct_byname<wchar_t>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE num_get<wchar_t>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE num_put<wchar_t>;
-  extern template class ctype_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT numpunct<wchar_t>;
+  extern template class _GLIBCXX_IMPORT numpunct_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE num_get<wchar_t>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE num_put<wchar_t>;
+  extern template class _GLIBCXX_IMPORT ctype_byname<wchar_t>;
 
   extern template
     const ctype<wchar_t>&
Index: libstdc++-v3/include/bits/locale_classes.h
===================================================================
--- libstdc++-v3/include/bits/locale_classes.h	(revision 151124)
+++ libstdc++-v3/include/bits/locale_classes.h	(working copy)
@@ -58,7 +58,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  This library supports efficient construction and copying of locales
    *  through a reference counting implementation of the locale class.
   */
-  class locale
+  class _GLIBCXX_IMPORT locale
   {
   public:
     // Types:
@@ -66,9 +66,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     typedef int	category;
 
     // Forward decls and friends:
-    class facet;
-    class id;
-    class _Impl;
+    class _GLIBCXX_IMPORT facet;
+    class _GLIBCXX_IMPORT id;
+    class _GLIBCXX_IMPORT _Impl;
 
     friend class facet;
     friend class _Impl;
@@ -332,7 +332,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *
    *  Facets may not be copied or assigned.
   */
-  class locale::facet
+  class _GLIBCXX_IMPORT locale::facet
   {
   private:
     friend class locale;
@@ -426,7 +426,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  cannot be used in a locale.  The locale::id ensures that each class
    *  type gets a unique identifier.
   */
-  class locale::id
+  class _GLIBCXX_IMPORT locale::id
   {
   private:
     friend class locale;
@@ -465,7 +465,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
 
   // Implementation object for locale.
-  class locale::_Impl
+  class _GLIBCXX_IMPORT locale::_Impl
   {
   public:
     // Friends.
Index: libstdc++-v3/include/bits/locale_facets.h
===================================================================
--- libstdc++-v3/include/bits/locale_facets.h	(revision 151124)
+++ libstdc++-v3/include/bits/locale_facets.h	(working copy)
@@ -671,7 +671,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  optimizations as well.
   */
   template<>
-    class ctype<char> : public locale::facet, public ctype_base
+    class _GLIBCXX_IMPORT ctype<char> : public locale::facet, public ctype_base
     {
     public:
       // Types:
@@ -1172,7 +1172,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  __ctype_abstract_base<wchar_t>.
   */
   template<>
-    class ctype<wchar_t> : public __ctype_abstract_base<wchar_t>
+    class _GLIBCXX_IMPORT ctype<wchar_t> : public __ctype_abstract_base<wchar_t>
     {
     public:
       // Types:
Index: libstdc++-v3/include/bits/basic_ios.tcc
===================================================================
--- libstdc++-v3/include/bits/basic_ios.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/basic_ios.tcc	(working copy)
@@ -175,10 +175,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_ios<char>;
+  extern template class _GLIBCXX_IMPORT basic_ios<char>;
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_ios<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_ios<wchar_t>;
 #endif
 #endif
 
Index: libstdc++-v3/include/bits/ios_base.h
===================================================================
--- libstdc++-v3/include/bits/ios_base.h	(revision 151124)
+++ libstdc++-v3/include/bits/ios_base.h	(working copy)
@@ -204,7 +204,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  people will only see @c ios_base when they need to specify the full
    *  name of the various I/O flags (e.g., the openmodes).
   */
-  class ios_base
+  class _GLIBCXX_IMPORT ios_base
   {
   public:
 
@@ -214,7 +214,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
      *
      *  27.4.2.1.1  Class ios_base::failure
      */
-    class failure : public exception
+    class _GLIBCXX_IMPORT failure : public exception
     {
     public:
       // _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -534,7 +534,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     // Used to initialize standard streams. In theory, g++ could use
     // -finit-priority to order this stuff correctly without going
     // through these machinations.
-    class Init
+    class _GLIBCXX_IMPORT Init
     {
       friend class ios_base;
     public:
Index: libstdc++-v3/include/bits/istream.tcc
===================================================================
--- libstdc++-v3/include/bits/istream.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/istream.tcc	(working copy)
@@ -1018,7 +1018,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_istream<char>;
+  extern template class _GLIBCXX_IMPORT basic_istream<char>;
   extern template istream& ws(istream&);
   extern template istream& operator>>(istream&, char&);
   extern template istream& operator>>(istream&, char*);
@@ -1041,10 +1041,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   extern template istream& istream::_M_extract(long double&);
   extern template istream& istream::_M_extract(void*&);
 
-  extern template class basic_iostream<char>;
+  extern template class _GLIBCXX_IMPORT basic_iostream<char>;
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_istream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_istream<wchar_t>;
   extern template wistream& ws(wistream&);
   extern template wistream& operator>>(wistream&, wchar_t&);
   extern template wistream& operator>>(wistream&, wchar_t*);
@@ -1063,7 +1063,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   extern template wistream& wistream::_M_extract(long double&);
   extern template wistream& wistream::_M_extract(void*&);
 
-  extern template class basic_iostream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_iostream<wchar_t>;
 #endif
 #endif
 
Index: libstdc++-v3/include/bits/codecvt.h
===================================================================
--- libstdc++-v3/include/bits/codecvt.h	(revision 151124)
+++ libstdc++-v3/include/bits/codecvt.h	(working copy)
@@ -469,7 +469,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class codecvt_byname<char, char, mbstate_t>;
+  extern template class _GLIBCXX_IMPORT codecvt_byname<char, char, mbstate_t>;
 
   extern template
     const codecvt<char, char, mbstate_t>&
@@ -480,7 +480,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     has_facet<codecvt<char, char, mbstate_t> >(const locale&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class codecvt_byname<wchar_t, char, mbstate_t>;
+  extern template class _GLIBCXX_IMPORT codecvt_byname<wchar_t, char, mbstate_t>;
 
   extern template
     const codecvt<wchar_t, char, mbstate_t>&
Index: libstdc++-v3/include/bits/ostream.tcc
===================================================================
--- libstdc++-v3/include/bits/ostream.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/ostream.tcc	(working copy)
@@ -357,7 +357,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_ostream<char>;
+  extern template class _GLIBCXX_IMPORT basic_ostream<char>;
   extern template ostream& endl(ostream&);
   extern template ostream& ends(ostream&);
   extern template ostream& flush(ostream&);
@@ -380,7 +380,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   extern template ostream& ostream::_M_insert(const void*);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_ostream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_ostream<wchar_t>;
   extern template wostream& endl(wostream&);
   extern template wostream& ends(wostream&);
   extern template wostream& flush(wostream&);
Index: libstdc++-v3/include/bits/sstream.tcc
===================================================================
--- libstdc++-v3/include/bits/sstream.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/sstream.tcc	(working copy)
@@ -255,16 +255,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_stringbuf<char>;
-  extern template class basic_istringstream<char>;
-  extern template class basic_ostringstream<char>;
-  extern template class basic_stringstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_stringbuf<char>;
+  extern template class _GLIBCXX_IMPORT basic_istringstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_ostringstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_stringstream<char>;
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_stringbuf<wchar_t>;
-  extern template class basic_istringstream<wchar_t>;
-  extern template class basic_ostringstream<wchar_t>;
-  extern template class basic_stringstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_stringbuf<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_istringstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_ostringstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_stringstream<wchar_t>;
 #endif
 #endif
 
Index: libstdc++-v3/include/bits/c++config
===================================================================
--- libstdc++-v3/include/bits/c++config	(revision 151124)
+++ libstdc++-v3/include/bits/c++config	(working copy)
@@ -334,4 +334,8 @@ _GLIBCXX_END_NAMESPACE
 # endif
 #endif
 
+#ifndef _GLIBCXX_IMPORT
+#define _GLIBCXX_IMPORT
+#endif
+
 // End of prewritten config; the discovered settings follow.
Index: libstdc++-v3/include/bits/basic_string.tcc
===================================================================
--- libstdc++-v3/include/bits/basic_string.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/basic_string.tcc	(working copy)
@@ -1130,32 +1130,32 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE > 0
-  extern template class basic_string<char>;
-  extern template
+  extern template class _GLIBCXX_IMPORT basic_string<char>;
+  extern template _GLIBCXX_IMPORT
     basic_istream<char>&
     operator>>(basic_istream<char>&, string&);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_ostream<char>&
     operator<<(basic_ostream<char>&, const string&);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_istream<char>&
     getline(basic_istream<char>&, string&, char);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_istream<char>&
     getline(basic_istream<char>&, string&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_string<wchar_t>;
-  extern template
+  extern template class _GLIBCXX_IMPORT basic_string<wchar_t>;
+  extern template _GLIBCXX_IMPORT
     basic_istream<wchar_t>&
     operator>>(basic_istream<wchar_t>&, wstring&);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_ostream<wchar_t>&
     operator<<(basic_ostream<wchar_t>&, const wstring&);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_istream<wchar_t>&
     getline(basic_istream<wchar_t>&, wstring&, wchar_t);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_istream<wchar_t>&
     getline(basic_istream<wchar_t>&, wstring&);
 #endif
Index: libstdc++-v3/include/bits/locale_facets_nonio.tcc
===================================================================
--- libstdc++-v3/include/bits/locale_facets_nonio.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/locale_facets_nonio.tcc	(working copy)
@@ -1189,19 +1189,19 @@ _GLIBCXX_END_LDBL_NAMESPACE
   // which are defined via explicit instantiations elsewhere.
   // NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class moneypunct<char, false>;
-  extern template class moneypunct<char, true>;
-  extern template class moneypunct_byname<char, false>;
-  extern template class moneypunct_byname<char, true>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE money_get<char>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE money_put<char>;
-  extern template class __timepunct<char>;
-  extern template class time_put<char>;
-  extern template class time_put_byname<char>;
-  extern template class time_get<char>;
-  extern template class time_get_byname<char>;
-  extern template class messages<char>;
-  extern template class messages_byname<char>;
+  extern template class _GLIBCXX_IMPORT moneypunct<char, false>;
+  extern template class _GLIBCXX_IMPORT moneypunct<char, true>;
+  extern template class _GLIBCXX_IMPORT moneypunct_byname<char, false>;
+  extern template class _GLIBCXX_IMPORT moneypunct_byname<char, true>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE money_get<char>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE money_put<char>;
+  extern template class _GLIBCXX_IMPORT __timepunct<char>;
+  extern template class _GLIBCXX_IMPORT time_put<char>;
+  extern template class _GLIBCXX_IMPORT time_put_byname<char>;
+  extern template class _GLIBCXX_IMPORT time_get<char>;
+  extern template class _GLIBCXX_IMPORT time_get_byname<char>;
+  extern template class _GLIBCXX_IMPORT messages<char>;
+  extern template class _GLIBCXX_IMPORT messages_byname<char>;
 
   extern template
     const moneypunct<char, true>&
@@ -1264,19 +1264,19 @@ _GLIBCXX_END_LDBL_NAMESPACE
     has_facet<messages<char> >(const locale&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class moneypunct<wchar_t, false>;
-  extern template class moneypunct<wchar_t, true>;
-  extern template class moneypunct_byname<wchar_t, false>;
-  extern template class moneypunct_byname<wchar_t, true>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE money_get<wchar_t>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE money_put<wchar_t>;
-  extern template class __timepunct<wchar_t>;
-  extern template class time_put<wchar_t>;
-  extern template class time_put_byname<wchar_t>;
-  extern template class time_get<wchar_t>;
-  extern template class time_get_byname<wchar_t>;
-  extern template class messages<wchar_t>;
-  extern template class messages_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT moneypunct<wchar_t, false>;
+  extern template class _GLIBCXX_IMPORT moneypunct<wchar_t, true>;
+  extern template class _GLIBCXX_IMPORT moneypunct_byname<wchar_t, false>;
+  extern template class _GLIBCXX_IMPORT moneypunct_byname<wchar_t, true>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE money_get<wchar_t>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE money_put<wchar_t>;
+  extern template class _GLIBCXX_IMPORT __timepunct<wchar_t>;
+  extern template class _GLIBCXX_IMPORT time_put<wchar_t>;
+  extern template class _GLIBCXX_IMPORT time_put_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT time_get<wchar_t>;
+  extern template class _GLIBCXX_IMPORT time_get_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT messages<wchar_t>;
+  extern template class _GLIBCXX_IMPORT messages_byname<wchar_t>;
 
   extern template
     const moneypunct<wchar_t, true>&
Index: libstdc++-v3/include/bits/streambuf.tcc
===================================================================
--- libstdc++-v3/include/bits/streambuf.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/streambuf.tcc	(working copy)
@@ -146,7 +146,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_streambuf<char>;
+  extern template class _GLIBCXX_IMPORT basic_streambuf<char>;
   extern template
     streamsize
     __copy_streambufs(basic_streambuf<char>*,
@@ -157,7 +157,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 			  basic_streambuf<char>*, bool&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_streambuf<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_streambuf<wchar_t>;
   extern template
     streamsize
     __copy_streambufs(basic_streambuf<wchar_t>*,
Index: libstdc++-v3/include/bits/fstream.tcc
===================================================================
--- libstdc++-v3/include/bits/fstream.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/fstream.tcc	(working copy)
@@ -908,16 +908,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_filebuf<char>;
-  extern template class basic_ifstream<char>;
-  extern template class basic_ofstream<char>;
-  extern template class basic_fstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_filebuf<char>;
+  extern template class _GLIBCXX_IMPORT basic_ifstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_ofstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_fstream<char>;
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_filebuf<wchar_t>;
-  extern template class basic_ifstream<wchar_t>;
-  extern template class basic_ofstream<wchar_t>;
-  extern template class basic_fstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_filebuf<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_ifstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_ofstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_fstream<wchar_t>;
 #endif
 #endif
 
Index: libstdc++-v3/include/backward/strstream
===================================================================
--- libstdc++-v3/include/backward/strstream	(revision 151124)
+++ libstdc++-v3/include/backward/strstream	(working copy)
@@ -54,7 +54,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   // Class strstreambuf, a streambuf class that manages an array of char.
   // Note that this class is not a template.
-  class strstreambuf : public basic_streambuf<char, char_traits<char> >
+  class _GLIBCXX_IMPORT strstreambuf : public basic_streambuf<char, char_traits<char> >
   {
   public:
     // Types.
@@ -116,7 +116,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   };
 
   // Class istrstream, an istream that manages a strstreambuf.
-  class istrstream : public basic_istream<char>
+  class _GLIBCXX_IMPORT istrstream : public basic_istream<char>
   {
   public:
     explicit istrstream(char*);
@@ -133,7 +133,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   };
 
   // Class ostrstream
-  class ostrstream : public basic_ostream<char>
+  class _GLIBCXX_IMPORT ostrstream : public basic_ostream<char>
   {
   public:
     ostrstream();
@@ -150,7 +150,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   };
 
   // Class strstream
-  class strstream : public basic_iostream<char>
+  class _GLIBCXX_IMPORT strstream : public basic_iostream<char>
   {
   public:
     typedef char                        char_type;
Index: libstdc++-v3/libsupc++/typeinfo
===================================================================
--- libstdc++-v3/libsupc++/typeinfo	(revision 151124)
+++ libstdc++-v3/libsupc++/typeinfo	(working copy)
@@ -82,7 +82,7 @@ namespace std
    *  The @c type_info class describes type information generated by
    *  an implementation.
   */
-  class type_info 
+  class _GLIBCXX_IMPORT type_info 
   {
   public:
     /** Destructor first. Being the first non-inline virtual function, this
@@ -166,7 +166,7 @@ namespace std
    *
    *  If you attempt an invalid @c dynamic_cast expression, an instance of
    *  this class (or something derived from this class) is thrown.  */
-  class bad_cast : public exception 
+  class _GLIBCXX_IMPORT bad_cast : public exception
   {
   public:
     bad_cast() throw() { }
@@ -183,7 +183,7 @@ namespace std
    *  @brief Thrown when a NULL pointer in a @c typeid expression is used.
    *  @ingroup exceptions
    */
-  class bad_typeid : public exception 
+  class _GLIBCXX_IMPORT bad_typeid : public exception 
   {
   public:
     bad_typeid () throw() { }
Index: libstdc++-v3/libsupc++/exception
===================================================================
--- libstdc++-v3/libsupc++/exception	(revision 151124)
+++ libstdc++-v3/libsupc++/exception	(working copy)
@@ -56,7 +56,7 @@ namespace std
    *  your own %exception classes, or use a different hierarchy, or to
    *  throw non-class data (e.g., fundamental types).
    */
-  class exception 
+  class _GLIBCXX_IMPORT exception
   {
   public:
     exception() throw() { }
@@ -69,7 +69,7 @@ namespace std
 
   /** If an %exception is thrown which is not listed in a function's
    *  %exception specification, one of these may be thrown.  */
-  class bad_exception : public exception 
+  class _GLIBCXX_IMPORT bad_exception : public exception
   {
   public:
     bad_exception() throw() { }
Index: libstdc++-v3/libsupc++/new
===================================================================
--- libstdc++-v3/libsupc++/new	(revision 151124)
+++ libstdc++-v3/libsupc++/new	(working copy)
@@ -51,7 +51,7 @@ namespace std
    *
    *  @c bad_alloc (or classes derived from it) is used to report allocation
    *  errors from the throwing forms of @c new.  */
-  class bad_alloc : public exception 
+  class _GLIBCXX_IMPORT bad_alloc : public exception
   {
   public:
     bad_alloc() throw() { }
Index: libstdc++-v3/testsuite/lib/libstdc++.exp
===================================================================
--- libstdc++-v3/testsuite/lib/libstdc++.exp	(revision 151124)
+++ libstdc++-v3/testsuite/lib/libstdc++.exp	(working copy)
@@ -114,6 +114,9 @@ proc libstdc++_init { testfile } {
 	if { [string match "powerpc-*-darwin*" $target_triplet] } {
 	    append DEFAULT_CXXFLAGS " -multiply_defined suppress"
 	} 
+	if { [string match "*-*-cygwin*" $target_triplet] } {
+	    append DEFAULT_CXXFLAGS " -Wl,--enable-auto-import"
+	} 
     }
     v3track DEFAULT_CXXFLAGS 2
 
@@ -134,6 +137,9 @@ proc libstdc++_init { testfile } {
         set gccdir [file dirname $gccdir]
 	append ld_library_path_tmp ":${gccdir}"
     }
+    if { [string match "*-*-cygwin*" $target_triplet] } {
+	append ld_library_path_tmp ":${blddir}/../libgcc"
+    }
     v3track gccdir 3
 
     # Locate libgomp. This is only required for parallel mode.
Index: libstdc++-v3/config/os/newlib/os_defines.h
===================================================================
--- libstdc++-v3/config/os/newlib/os_defines.h	(revision 151124)
+++ libstdc++-v3/config/os/newlib/os_defines.h	(working copy)
@@ -38,6 +38,13 @@
 
 // See libstdc++/20806.
 #define _GLIBCXX_HAVE_DOS_BASED_FILESYSTEM 1
+
+#ifdef _GLIBCXX_DLL
+#define _GLIBCXX_IMPORT __attribute__((dllimport))
+#else
+#define _GLIBCXX_IMPORT
 #endif
 
 #endif
+
+#endif
Index: libstdc++-v3/config/os/mingw32/os_defines.h
===================================================================
--- libstdc++-v3/config/os/mingw32/os_defines.h	(revision 151124)
+++ libstdc++-v3/config/os/mingw32/os_defines.h	(working copy)
@@ -51,4 +51,10 @@
 // See  libstdc++/37522.
 #define _GLIBCXX_HAVE_BROKEN_VSWPRINTF 1
 
+#ifdef _GLIBCXX_DLL
+#define _GLIBCXX_IMPORT __attribute__((dllimport))
+#else
+#define _GLIBCXX_IMPORT
 #endif
+
+#endif

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Build libstdc++ as a DLL on Windows, updated for new  autotools.
  2009-08-28 23:21 [PATCH] Build libstdc++ as a DLL on Windows, updated for new autotools Dave Korn
@ 2009-08-31 21:43 ` Dave Korn
  2009-09-03  4:06 ` Dave Korn
  1 sibling, 0 replies; 4+ messages in thread
From: Dave Korn @ 2009-08-31 21:43 UTC (permalink / raw)
  To: Dave Korn; +Cc: GCC Patches, libstdc++, Benjamin Kosnik

Dave Korn wrote:

>   Bootstrapped on i686-pc-cygwin, tests still running.  

  Results: http://gcc.gnu.org/ml/gcc-testresults/2009-08/msg03258.html

  It looks pretty good to me.  There are some FAILs I haven't seen before but
I think they are all from very recently-added tests; I'm now doing a testrun
of an unpatched version of the same SVN revision just to verify that they were
already FAILing on HEAD with static libstdc++.  Results from that will take
another day or so.

    cheers,
      DaveK


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Build libstdc++ as a DLL on Windows, updated for new  autotools.
  2009-08-28 23:21 [PATCH] Build libstdc++ as a DLL on Windows, updated for new autotools Dave Korn
  2009-08-31 21:43 ` Dave Korn
@ 2009-09-03  4:06 ` Dave Korn
  2009-09-08  4:03   ` Dave Korn
  1 sibling, 1 reply; 4+ messages in thread
From: Dave Korn @ 2009-09-03  4:06 UTC (permalink / raw)
  To: Dave Korn; +Cc: GCC Patches, libstdc++, Benjamin Kosnik

[-- Attachment #1: Type: text/plain, Size: 6222 bytes --]

Dave Korn wrote:
> [ refs:   The original series of patches at
>   [0/4]  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01042.html
>   [1/4]  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01044.html
>   [2/4]  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01046.html
>   [3/4]  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01047.html
>   [4/4]  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01048.html
>  and the tweaked respin at
>          http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01631.html
>  and the updated tweaked respin at
>          http://gcc.gnu.org/ml/gcc-patches/2009-08/msg00877.html
   and the updated updated tweaked respin at
           http://gcc.gnu.org/ml/gcc-patches/2009-08/msg01570.html ]


    Well hello again listmates(*),

  Ben found that a bug had crept into this patch at some stage during
development in the case of configuring GCC against an old version of the
Cygwin DLL that doesn't provide the support required by the new libstdc++ DLL
for C++ operator new/delete function replacement.  A careless tweak to the way
the spec line is assembled from macros left an invalid empty colon hanging around.

  That is fixed in this minor revision of the patch (Ben, it's the same as the
one I sent you offlist) by being slightly more careful in
gcc/config/i386/cygwin.h; apart from that it is identical to the previous version.

  Successfully bootstrapped on both Cygwin 1.5 and Cygwin 1.7, thus proving
that it now works for both old and new Cygwin DLLs with or without the
function replacement wrapper support.

  Tests now running, results looking spotless so far; if, as reasonably
anticipated, no regressions, OK for HEAD now?


gcc/ChangeLog:

	* configure.ac (USE_CYGWIN_LIBSTDCXX_WRAPPERS): Define to reflect
	status of AC_CHECK_FUNC for Cygwin DLL libstdc++ support wrappers.
	* configure: Regenerate.
	* config.in: Regenerate.

	* config/i386/cygwin.h (CXX_WRAP_SPEC_LIST): Define list of --wrap
	options for Cygwin DLL libstdc++ support wrappers.
	(CXX_WRAP_SPEC_OPT): Define spec to use wrappers or not by default
	according to defined value of USE_CYGWIN_LIBSTDCXX_WRAPPERS.
	(CXX_WRAP_SPEC): Define entire wrapper spec in or out according to
	whether USE_CYGWIN_LIBSTDCXX_WRAPPERS is even defined or not.
	(LINK_SPEC): Include CXX_WRAP_SPEC.
	* config/i386/cygming.opt (muse-libstdc-wrappers): New option for
	Cygwin targets. Update copyright year.

libstdc++-v3/ChangeLog:

	* src/Makefile.am (libstdc___la_LDFLAGS): Add -no-undefined and
	-bindir switches.
	* src/Makefile.in: Regenerate.

	* config/os/newlib/os_defines.h (_GLIBCXX_IMPORT): Define to
	dllimport when indicated by _GLIBCXX_DLL.
	* config/os/mingw32/os_defines.h (_GLIBCXX_IMPORT): Likewise.
	* include/bits/c++config (_GLIBCXX_IMPORT): Add empty definition
	for non-dllimport targets.

	* include/std/iostream (cin): Annotate with _GLIBCXX_IMPORT.
	(cout, cerr, clog): Likewise.
	* include/std/stdexcept (class logic_error, domain_error,
	invalid_argument, length_error, out_of_range, runtime_error,
	range_error, underflow_error): Likewise.
	* include/ext/concurrence.h (class __concurrence_lock_error,
	__concurrence_unlock_error): Likewise.
	* include/bits/locale_classes.tcc (template class collate<char>,
	collate_byname<char>, collate<wchar_t>,
	collate_byname<wchar_t>): Likewise.
	* include/bits/locale_facets.tcc (template class numpunct<char>,
	numpunct_byname<char>, num_get<char>, num_put<char>,
	ctype_byname<char>, numpunct<wchar_t>, numpunct_byname<wchar_t>,
	num_get<wchar_t>, num_put<wchar_t>, ctype_byname<wchar_t>): Likewise.
	* include/bits/locale_classes.h (class locale, facet, id, _Impl,
	locale::facet, locale::id, locale::_Impl): Likewise.
	* include/bits/locale_facets.h (template class ctype<char>,
	ctype<wchar_t>): Likewise.
	* include/bits/basic_ios.tcc (template class basic_ios<char>,
	basic_ios<wchar_t>): Likewise.
	* include/bits/ios_base.h (class ios_base, failure, Init): Likewise.
	* include/bits/istream.tcc (template class basic_istream<char>,
	basic_iostream<char>, basic_istream<wchar_t>,
	basic_iostream<wchar_t>): Likewise.
	* include/bits/codecvt.h (template class codecvt_byname<char, char,
	mbstate_t>, codecvt_byname<wchar_t, char, mbstate_t>): Likewise.
	* include/bits/ostream.tcc (template class basic_ostream<char>,
	basic_ostream<wchar_t>): Likewise.
	* include/bits/sstream.tcc (template class basic_stringbuf<char>,
	basic_istringstream<char>, basic_ostringstream<char>,
	basic_stringstream<char>, basic_stringbuf<wchar_t>,
	basic_istringstream<wchar_t>, basic_ostringstream<wchar_t>,
	basic_stringstream<wchar_t>): Likewise.
	* include/bits/basic_string.tcc (template class basic_string<char>,
	basic_string<wchar_t>, related overloaded operator<<, operator>>,
	getline): Likewise.
	* include/bits/locale_facets_nonio.tcc (template class
	moneypunct<char, false>, moneypunct<char, true>,
	moneypunct_byname<char, false>, moneypunct_byname<char, true>,
	money_get<char>, money_put<char>, __timepunct<char>, time_put<char>,
	time_put_byname<char>, time_get<char>, time_get_byname<char>,
	messages<char>, messages_byname<char>, moneypunct<wchar_t, false>,
	moneypunct<wchar_t, true>, moneypunct_byname<wchar_t, false>,
	moneypunct_byname<wchar_t, true>, money_get<wchar_t>,
	money_put<wchar_t>, __timepunct<wchar_t>, time_put<wchar_t>,
	time_put_byname<wchar_t>, time_get<wchar_t>, time_get_byname<wchar_t>,
	messages<wchar_t>, messages_byname<wchar_t>): Likewise.
	* include/bits/streambuf.tcc (template class basic_streambuf<char>,
	basic_streambuf<wchar_t>): Likewise.
	* include/bits/fstream.tcc (template class basic_filebuf<char>,
	basic_ifstream<char>, basic_ofstream<char>, basic_fstream<char>,
	basic_filebuf<wchar_t>, basic_ifstream<wchar_t>,
	basic_ofstream<wchar_t>, basic_fstream<wchar_t>): Likewise.
	* include/backward/strstream (class strstreambuf, istrstream,
	ostrstream, strstream): Likewise.
	* libsupc++/typeinfo (class type_info, bad_cast,
	bad_typeid): Likewise.
	* libsupc++/exception (class exception, bad_exception): Likewise.
	* libsupc++/new (class bad_alloc): Likewise.

	* testsuite/lib/libstdc++.exp (proc libstdc++_init): Adjust
	DEFAULT_CXXFLAGS and ld_library_path_tmp for Cygwin.

    cheers,
      DaveK
-- 
(*) - Yarrrrr!

[-- Attachment #2: libstdc-dll-final.diff --]
[-- Type: text/x-c, Size: 35266 bytes --]

Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 151124)
+++ gcc/configure.ac	(working copy)
@@ -2971,6 +2971,19 @@ changequote(,)dnl
   i[34567]86-*-* | x86_64-*-*)
 changequote([,])dnl
     case $target_os in
+      cygwin*)
+	# Full C++ conformance when using a shared libstdc++-v3 requires some
+	# support from the Cygwin DLL, which in more recent versions exports
+	# wrappers to aid in interposing and redirecting operators new, delete,
+	# etc., as per n2800 #17.6.4.6 [replacement.functions].  Check if we
+	# are configuring for a version of Cygwin that exports the wrappers.
+	AC_CHECK_FUNC([__wrap__Znaj],[gcc_ac_cygwin_dll_wrappers=yes],[gcc_ac_cygwin_dll_wrappers=no])
+	AC_DEFINE_UNQUOTED(USE_CYGWIN_LIBSTDCXX_WRAPPERS,
+	  [`if test $gcc_ac_cygwin_dll_wrappers = yes; then echo 1; else echo 0; fi`],
+	  [Define if you want to generate code by default that assumes that the
+	   Cygwin DLL exports wrappers to support libstdc++ function replacement.])
+    esac
+    case $target_os in
       cygwin* | pe | mingw32*)
 	# Recent binutils allows the three-operand form of ".comm" on PE.  This
 	# definition is used unconditionally to initialise the default state of
Index: gcc/config/i386/cygwin.h
===================================================================
--- gcc/config/i386/cygwin.h	(revision 151124)
+++ gcc/config/i386/cygwin.h	(working copy)
@@ -85,9 +85,41 @@ along with GCC; see the file COPYING3.  If not see
   %{mwindows:-lgdi32 -lcomdlg32} \
   -luser32 -lkernel32 -ladvapi32 -lshell32"
 
+/* To implement C++ function replacement we always wrap the cxx
+   malloc-like operators.  See N2800 #17.6.4.6 [replacement.functions] */
+#define CXX_WRAP_SPEC_LIST "%{!static: %{!static-libstdc++: \
+  --wrap _Znwj \
+  --wrap _Znaj \
+  --wrap _ZdlPv \
+  --wrap _ZdaPv \
+  --wrap _ZnwjRKSt9nothrow_t \
+  --wrap _ZnajRKSt9nothrow_t \
+  --wrap _ZdlPvRKSt9nothrow_t \
+  --wrap _ZdaPvRKSt9nothrow_t \
+  }}"
+
+#if defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)
+
+#if USE_CYGWIN_LIBSTDCXX_WRAPPERS
+/* Default on, only explict -mno disables.  */
+#define CXX_WRAP_SPEC_OPT "!mno-use-libstdc-wrappers"
+#else
+/* Default off, only explict -m enables.  */
+#define CXX_WRAP_SPEC_OPT "muse-libstdc-wrappers"
+#endif
+
+#define CXX_WRAP_SPEC "%{" CXX_WRAP_SPEC_OPT ":" CXX_WRAP_SPEC_LIST "}"
+
+#else /* !defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)  */
+
+#define CXX_WRAP_SPEC ""
+
+#endif /* ?defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS) */
+
 #define LINK_SPEC "\
   %{mwindows:--subsystem windows} \
   %{mconsole:--subsystem console} \
+  " CXX_WRAP_SPEC " \
   %{shared: %{mdll: %eshared and mdll are not compatible}} \
   %{shared: --shared} %{mdll:--dll} \
   %{static:-Bstatic} %{!static:-Bdynamic} \
Index: gcc/config/i386/cygming.opt
===================================================================
--- gcc/config/i386/cygming.opt	(revision 151124)
+++ gcc/config/i386/cygming.opt	(working copy)
@@ -1,6 +1,6 @@
 ; Cygwin- and MinGW-specific options.
 
-; Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+; Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
 ;
 ; This file is part of GCC.
 ;
@@ -49,3 +49,7 @@ Create GUI application
 mpe-aligned-commons
 Target Var(use_pe_aligned_common) Init(HAVE_GAS_ALIGNED_COMM)
 Use the GNU extension to the PE format for aligned common data
+
+muse-libstdc-wrappers
+Target C++ Condition({defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)})
+Compile code that relies on Cygwin DLL wrappers to support C++ operator new/delete replacement
Index: libstdc++-v3/src/Makefile.am
===================================================================
--- libstdc++-v3/src/Makefile.am	(revision 151124)
+++ libstdc++-v3/src/Makefile.am	(working copy)
@@ -207,7 +207,8 @@ libstdc___la_DEPENDENCIES = \
 	$(top_builddir)/libsupc++/libsupc++convenience.la
 
 libstdc___la_LDFLAGS = \
-	-version-info $(libtool_VERSION) ${version_arg} -lm 
+	-version-info $(libtool_VERSION) ${version_arg} -lm \
+	-no-undefined -bindir $(bindir)
 
 # Use special rules for the deprecated source files so that they find
 # deprecated include files.
Index: libstdc++-v3/include/std/iostream
===================================================================
--- libstdc++-v3/include/std/iostream	(revision 151124)
+++ libstdc++-v3/include/std/iostream	(working copy)
@@ -55,16 +55,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  termination.  For more information, see the HOWTO linked to above.
   */
   //@{
-  extern istream cin;		///< Linked to standard input
-  extern ostream cout;		///< Linked to standard output
-  extern ostream cerr;		///< Linked to standard error (unbuffered)
-  extern ostream clog;		///< Linked to standard error (buffered)
+  extern _GLIBCXX_IMPORT istream cin;		///< Linked to standard input
+  extern _GLIBCXX_IMPORT ostream cout;		///< Linked to standard output
+  extern _GLIBCXX_IMPORT ostream cerr;		///< Linked to standard error (unbuffered)
+  extern _GLIBCXX_IMPORT ostream clog;		///< Linked to standard error (buffered)
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern wistream wcin;		///< Linked to standard input
-  extern wostream wcout;	///< Linked to standard output
-  extern wostream wcerr;	///< Linked to standard error (unbuffered)
-  extern wostream wclog;	///< Linked to standard error (buffered)
+  extern _GLIBCXX_IMPORT wistream wcin;		///< Linked to standard input
+  extern _GLIBCXX_IMPORT wostream wcout;	///< Linked to standard output
+  extern _GLIBCXX_IMPORT wostream wcerr;	///< Linked to standard error (unbuffered)
+  extern _GLIBCXX_IMPORT wostream wclog;	///< Linked to standard error (buffered)
 #endif
   //@}
 
Index: libstdc++-v3/include/std/stdexcept
===================================================================
--- libstdc++-v3/include/std/stdexcept	(revision 151124)
+++ libstdc++-v3/include/std/stdexcept	(working copy)
@@ -50,7 +50,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  program runs (e.g., violations of class invariants).
    *  @brief One of two subclasses of exception.
    */
-  class logic_error : public exception 
+  class _GLIBCXX_IMPORT logic_error : public exception
   {
     string _M_msg;
 
@@ -70,14 +70,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   /** Thrown by the library, or by you, to report domain errors (domain in
    *  the mathematical sense).  */
-  class domain_error : public logic_error 
+  class _GLIBCXX_IMPORT domain_error : public logic_error
   {
   public:
     explicit domain_error(const string& __arg);
   };
 
   /** Thrown to report invalid arguments to functions.  */
-  class invalid_argument : public logic_error 
+  class _GLIBCXX_IMPORT invalid_argument : public logic_error
   {
   public:
     explicit invalid_argument(const string& __arg);
@@ -85,7 +85,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   /** Thrown when an object is constructed that would exceed its maximum
    *  permitted size (e.g., a basic_string instance).  */
-  class length_error : public logic_error 
+  class _GLIBCXX_IMPORT length_error : public logic_error
   {
   public:
     explicit length_error(const string& __arg);
@@ -93,7 +93,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   /** This represents an argument whose value is not within the expected
    *  range (e.g., boundary checks in basic_string).  */
-  class out_of_range : public logic_error 
+  class _GLIBCXX_IMPORT out_of_range : public logic_error
   {
   public:
     explicit out_of_range(const string& __arg);
@@ -104,7 +104,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  the program executes.
    *  @brief One of two subclasses of exception.
    */
-  class runtime_error : public exception 
+  class _GLIBCXX_IMPORT runtime_error : public exception
   {
     string _M_msg;
 
@@ -123,7 +123,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   };
 
   /** Thrown to indicate range errors in internal computations.  */
-  class range_error : public runtime_error 
+  class _GLIBCXX_IMPORT range_error : public runtime_error
   {
   public:
     explicit range_error(const string& __arg);
@@ -137,7 +137,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   };
 
   /** Thrown to indicate arithmetic underflow.  */
-  class underflow_error : public runtime_error 
+  class _GLIBCXX_IMPORT underflow_error : public runtime_error
   {
   public:
     explicit underflow_error(const string& __arg);
Index: libstdc++-v3/include/ext/concurrence.h
===================================================================
--- libstdc++-v3/include/ext/concurrence.h	(revision 151124)
+++ libstdc++-v3/include/ext/concurrence.h	(working copy)
@@ -60,7 +60,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 
   // NB: As this is used in libsupc++, need to only depend on
   // exception. No stdexception classes, no use of std::string.
-  class __concurrence_lock_error : public std::exception
+  class _GLIBCXX_IMPORT __concurrence_lock_error : public std::exception
   {
   public:
     virtual char const*
@@ -68,7 +68,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
     { return "__gnu_cxx::__concurrence_lock_error"; }
   };
 
-  class __concurrence_unlock_error : public std::exception
+  class _GLIBCXX_IMPORT __concurrence_unlock_error : public std::exception
   {
   public:
     virtual char const*
Index: libstdc++-v3/include/bits/locale_classes.tcc
===================================================================
--- libstdc++-v3/include/bits/locale_classes.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/locale_classes.tcc	(working copy)
@@ -241,8 +241,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class collate<char>;
-  extern template class collate_byname<char>;
+  extern template class _GLIBCXX_IMPORT collate<char>;
+  extern template class _GLIBCXX_IMPORT collate_byname<char>;
 
   extern template
     const collate<char>&
@@ -253,8 +253,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     has_facet<collate<char> >(const locale&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class collate<wchar_t>;
-  extern template class collate_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT collate<wchar_t>;
+  extern template class _GLIBCXX_IMPORT collate_byname<wchar_t>;
 
   extern template
     const collate<wchar_t>&
Index: libstdc++-v3/include/bits/locale_facets.tcc
===================================================================
--- libstdc++-v3/include/bits/locale_facets.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/locale_facets.tcc	(working copy)
@@ -1276,11 +1276,11 @@ _GLIBCXX_END_LDBL_NAMESPACE
   // which are defined via explicit instantiations elsewhere.
   // NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class numpunct<char>;
-  extern template class numpunct_byname<char>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE num_get<char>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE num_put<char>;
-  extern template class ctype_byname<char>;
+  extern template class _GLIBCXX_IMPORT numpunct<char>;
+  extern template class _GLIBCXX_IMPORT numpunct_byname<char>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE num_get<char>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE num_put<char>;
+  extern template class _GLIBCXX_IMPORT ctype_byname<char>;
 
   extern template
     const ctype<char>&
@@ -1315,11 +1315,11 @@ _GLIBCXX_END_LDBL_NAMESPACE
     has_facet<num_get<char> >(const locale&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class numpunct<wchar_t>;
-  extern template class numpunct_byname<wchar_t>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE num_get<wchar_t>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE num_put<wchar_t>;
-  extern template class ctype_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT numpunct<wchar_t>;
+  extern template class _GLIBCXX_IMPORT numpunct_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE num_get<wchar_t>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE num_put<wchar_t>;
+  extern template class _GLIBCXX_IMPORT ctype_byname<wchar_t>;
 
   extern template
     const ctype<wchar_t>&
Index: libstdc++-v3/include/bits/locale_classes.h
===================================================================
--- libstdc++-v3/include/bits/locale_classes.h	(revision 151124)
+++ libstdc++-v3/include/bits/locale_classes.h	(working copy)
@@ -58,7 +58,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  This library supports efficient construction and copying of locales
    *  through a reference counting implementation of the locale class.
   */
-  class locale
+  class _GLIBCXX_IMPORT locale
   {
   public:
     // Types:
@@ -66,9 +66,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     typedef int	category;
 
     // Forward decls and friends:
-    class facet;
-    class id;
-    class _Impl;
+    class _GLIBCXX_IMPORT facet;
+    class _GLIBCXX_IMPORT id;
+    class _GLIBCXX_IMPORT _Impl;
 
     friend class facet;
     friend class _Impl;
@@ -332,7 +332,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *
    *  Facets may not be copied or assigned.
   */
-  class locale::facet
+  class _GLIBCXX_IMPORT locale::facet
   {
   private:
     friend class locale;
@@ -426,7 +426,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  cannot be used in a locale.  The locale::id ensures that each class
    *  type gets a unique identifier.
   */
-  class locale::id
+  class _GLIBCXX_IMPORT locale::id
   {
   private:
     friend class locale;
@@ -465,7 +465,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
 
   // Implementation object for locale.
-  class locale::_Impl
+  class _GLIBCXX_IMPORT locale::_Impl
   {
   public:
     // Friends.
Index: libstdc++-v3/include/bits/locale_facets.h
===================================================================
--- libstdc++-v3/include/bits/locale_facets.h	(revision 151124)
+++ libstdc++-v3/include/bits/locale_facets.h	(working copy)
@@ -671,7 +671,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  optimizations as well.
   */
   template<>
-    class ctype<char> : public locale::facet, public ctype_base
+    class _GLIBCXX_IMPORT ctype<char> : public locale::facet, public ctype_base
     {
     public:
       // Types:
@@ -1172,7 +1172,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  __ctype_abstract_base<wchar_t>.
   */
   template<>
-    class ctype<wchar_t> : public __ctype_abstract_base<wchar_t>
+    class _GLIBCXX_IMPORT ctype<wchar_t> : public __ctype_abstract_base<wchar_t>
     {
     public:
       // Types:
Index: libstdc++-v3/include/bits/basic_ios.tcc
===================================================================
--- libstdc++-v3/include/bits/basic_ios.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/basic_ios.tcc	(working copy)
@@ -175,10 +175,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_ios<char>;
+  extern template class _GLIBCXX_IMPORT basic_ios<char>;
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_ios<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_ios<wchar_t>;
 #endif
 #endif
 
Index: libstdc++-v3/include/bits/ios_base.h
===================================================================
--- libstdc++-v3/include/bits/ios_base.h	(revision 151124)
+++ libstdc++-v3/include/bits/ios_base.h	(working copy)
@@ -204,7 +204,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  people will only see @c ios_base when they need to specify the full
    *  name of the various I/O flags (e.g., the openmodes).
   */
-  class ios_base
+  class _GLIBCXX_IMPORT ios_base
   {
   public:
 
@@ -214,7 +214,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
      *
      *  27.4.2.1.1  Class ios_base::failure
      */
-    class failure : public exception
+    class _GLIBCXX_IMPORT failure : public exception
     {
     public:
       // _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -534,7 +534,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     // Used to initialize standard streams. In theory, g++ could use
     // -finit-priority to order this stuff correctly without going
     // through these machinations.
-    class Init
+    class _GLIBCXX_IMPORT Init
     {
       friend class ios_base;
     public:
Index: libstdc++-v3/include/bits/istream.tcc
===================================================================
--- libstdc++-v3/include/bits/istream.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/istream.tcc	(working copy)
@@ -1018,7 +1018,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_istream<char>;
+  extern template class _GLIBCXX_IMPORT basic_istream<char>;
   extern template istream& ws(istream&);
   extern template istream& operator>>(istream&, char&);
   extern template istream& operator>>(istream&, char*);
@@ -1041,10 +1041,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   extern template istream& istream::_M_extract(long double&);
   extern template istream& istream::_M_extract(void*&);
 
-  extern template class basic_iostream<char>;
+  extern template class _GLIBCXX_IMPORT basic_iostream<char>;
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_istream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_istream<wchar_t>;
   extern template wistream& ws(wistream&);
   extern template wistream& operator>>(wistream&, wchar_t&);
   extern template wistream& operator>>(wistream&, wchar_t*);
@@ -1063,7 +1063,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   extern template wistream& wistream::_M_extract(long double&);
   extern template wistream& wistream::_M_extract(void*&);
 
-  extern template class basic_iostream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_iostream<wchar_t>;
 #endif
 #endif
 
Index: libstdc++-v3/include/bits/codecvt.h
===================================================================
--- libstdc++-v3/include/bits/codecvt.h	(revision 151124)
+++ libstdc++-v3/include/bits/codecvt.h	(working copy)
@@ -469,7 +469,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class codecvt_byname<char, char, mbstate_t>;
+  extern template class _GLIBCXX_IMPORT codecvt_byname<char, char, mbstate_t>;
 
   extern template
     const codecvt<char, char, mbstate_t>&
@@ -480,7 +480,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     has_facet<codecvt<char, char, mbstate_t> >(const locale&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class codecvt_byname<wchar_t, char, mbstate_t>;
+  extern template class _GLIBCXX_IMPORT codecvt_byname<wchar_t, char, mbstate_t>;
 
   extern template
     const codecvt<wchar_t, char, mbstate_t>&
Index: libstdc++-v3/include/bits/ostream.tcc
===================================================================
--- libstdc++-v3/include/bits/ostream.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/ostream.tcc	(working copy)
@@ -357,7 +357,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_ostream<char>;
+  extern template class _GLIBCXX_IMPORT basic_ostream<char>;
   extern template ostream& endl(ostream&);
   extern template ostream& ends(ostream&);
   extern template ostream& flush(ostream&);
@@ -380,7 +380,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   extern template ostream& ostream::_M_insert(const void*);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_ostream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_ostream<wchar_t>;
   extern template wostream& endl(wostream&);
   extern template wostream& ends(wostream&);
   extern template wostream& flush(wostream&);
Index: libstdc++-v3/include/bits/sstream.tcc
===================================================================
--- libstdc++-v3/include/bits/sstream.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/sstream.tcc	(working copy)
@@ -255,16 +255,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_stringbuf<char>;
-  extern template class basic_istringstream<char>;
-  extern template class basic_ostringstream<char>;
-  extern template class basic_stringstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_stringbuf<char>;
+  extern template class _GLIBCXX_IMPORT basic_istringstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_ostringstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_stringstream<char>;
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_stringbuf<wchar_t>;
-  extern template class basic_istringstream<wchar_t>;
-  extern template class basic_ostringstream<wchar_t>;
-  extern template class basic_stringstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_stringbuf<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_istringstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_ostringstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_stringstream<wchar_t>;
 #endif
 #endif
 
Index: libstdc++-v3/include/bits/c++config
===================================================================
--- libstdc++-v3/include/bits/c++config	(revision 151124)
+++ libstdc++-v3/include/bits/c++config	(working copy)
@@ -334,4 +334,8 @@ _GLIBCXX_END_NAMESPACE
 # endif
 #endif
 
+#ifndef _GLIBCXX_IMPORT
+#define _GLIBCXX_IMPORT
+#endif
+
 // End of prewritten config; the discovered settings follow.
Index: libstdc++-v3/include/bits/basic_string.tcc
===================================================================
--- libstdc++-v3/include/bits/basic_string.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/basic_string.tcc	(working copy)
@@ -1130,32 +1130,32 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE > 0
-  extern template class basic_string<char>;
-  extern template
+  extern template class _GLIBCXX_IMPORT basic_string<char>;
+  extern template _GLIBCXX_IMPORT
     basic_istream<char>&
     operator>>(basic_istream<char>&, string&);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_ostream<char>&
     operator<<(basic_ostream<char>&, const string&);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_istream<char>&
     getline(basic_istream<char>&, string&, char);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_istream<char>&
     getline(basic_istream<char>&, string&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_string<wchar_t>;
-  extern template
+  extern template class _GLIBCXX_IMPORT basic_string<wchar_t>;
+  extern template _GLIBCXX_IMPORT
     basic_istream<wchar_t>&
     operator>>(basic_istream<wchar_t>&, wstring&);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_ostream<wchar_t>&
     operator<<(basic_ostream<wchar_t>&, const wstring&);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_istream<wchar_t>&
     getline(basic_istream<wchar_t>&, wstring&, wchar_t);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_istream<wchar_t>&
     getline(basic_istream<wchar_t>&, wstring&);
 #endif
Index: libstdc++-v3/include/bits/locale_facets_nonio.tcc
===================================================================
--- libstdc++-v3/include/bits/locale_facets_nonio.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/locale_facets_nonio.tcc	(working copy)
@@ -1189,19 +1189,19 @@ _GLIBCXX_END_LDBL_NAMESPACE
   // which are defined via explicit instantiations elsewhere.
   // NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class moneypunct<char, false>;
-  extern template class moneypunct<char, true>;
-  extern template class moneypunct_byname<char, false>;
-  extern template class moneypunct_byname<char, true>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE money_get<char>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE money_put<char>;
-  extern template class __timepunct<char>;
-  extern template class time_put<char>;
-  extern template class time_put_byname<char>;
-  extern template class time_get<char>;
-  extern template class time_get_byname<char>;
-  extern template class messages<char>;
-  extern template class messages_byname<char>;
+  extern template class _GLIBCXX_IMPORT moneypunct<char, false>;
+  extern template class _GLIBCXX_IMPORT moneypunct<char, true>;
+  extern template class _GLIBCXX_IMPORT moneypunct_byname<char, false>;
+  extern template class _GLIBCXX_IMPORT moneypunct_byname<char, true>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE money_get<char>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE money_put<char>;
+  extern template class _GLIBCXX_IMPORT __timepunct<char>;
+  extern template class _GLIBCXX_IMPORT time_put<char>;
+  extern template class _GLIBCXX_IMPORT time_put_byname<char>;
+  extern template class _GLIBCXX_IMPORT time_get<char>;
+  extern template class _GLIBCXX_IMPORT time_get_byname<char>;
+  extern template class _GLIBCXX_IMPORT messages<char>;
+  extern template class _GLIBCXX_IMPORT messages_byname<char>;
 
   extern template
     const moneypunct<char, true>&
@@ -1264,19 +1264,19 @@ _GLIBCXX_END_LDBL_NAMESPACE
     has_facet<messages<char> >(const locale&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class moneypunct<wchar_t, false>;
-  extern template class moneypunct<wchar_t, true>;
-  extern template class moneypunct_byname<wchar_t, false>;
-  extern template class moneypunct_byname<wchar_t, true>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE money_get<wchar_t>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE money_put<wchar_t>;
-  extern template class __timepunct<wchar_t>;
-  extern template class time_put<wchar_t>;
-  extern template class time_put_byname<wchar_t>;
-  extern template class time_get<wchar_t>;
-  extern template class time_get_byname<wchar_t>;
-  extern template class messages<wchar_t>;
-  extern template class messages_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT moneypunct<wchar_t, false>;
+  extern template class _GLIBCXX_IMPORT moneypunct<wchar_t, true>;
+  extern template class _GLIBCXX_IMPORT moneypunct_byname<wchar_t, false>;
+  extern template class _GLIBCXX_IMPORT moneypunct_byname<wchar_t, true>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE money_get<wchar_t>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE money_put<wchar_t>;
+  extern template class _GLIBCXX_IMPORT __timepunct<wchar_t>;
+  extern template class _GLIBCXX_IMPORT time_put<wchar_t>;
+  extern template class _GLIBCXX_IMPORT time_put_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT time_get<wchar_t>;
+  extern template class _GLIBCXX_IMPORT time_get_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT messages<wchar_t>;
+  extern template class _GLIBCXX_IMPORT messages_byname<wchar_t>;
 
   extern template
     const moneypunct<wchar_t, true>&
Index: libstdc++-v3/include/bits/streambuf.tcc
===================================================================
--- libstdc++-v3/include/bits/streambuf.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/streambuf.tcc	(working copy)
@@ -146,7 +146,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_streambuf<char>;
+  extern template class _GLIBCXX_IMPORT basic_streambuf<char>;
   extern template
     streamsize
     __copy_streambufs(basic_streambuf<char>*,
@@ -157,7 +157,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 			  basic_streambuf<char>*, bool&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_streambuf<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_streambuf<wchar_t>;
   extern template
     streamsize
     __copy_streambufs(basic_streambuf<wchar_t>*,
Index: libstdc++-v3/include/bits/fstream.tcc
===================================================================
--- libstdc++-v3/include/bits/fstream.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/fstream.tcc	(working copy)
@@ -908,16 +908,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_filebuf<char>;
-  extern template class basic_ifstream<char>;
-  extern template class basic_ofstream<char>;
-  extern template class basic_fstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_filebuf<char>;
+  extern template class _GLIBCXX_IMPORT basic_ifstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_ofstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_fstream<char>;
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_filebuf<wchar_t>;
-  extern template class basic_ifstream<wchar_t>;
-  extern template class basic_ofstream<wchar_t>;
-  extern template class basic_fstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_filebuf<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_ifstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_ofstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_fstream<wchar_t>;
 #endif
 #endif
 
Index: libstdc++-v3/include/backward/strstream
===================================================================
--- libstdc++-v3/include/backward/strstream	(revision 151124)
+++ libstdc++-v3/include/backward/strstream	(working copy)
@@ -54,7 +54,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   // Class strstreambuf, a streambuf class that manages an array of char.
   // Note that this class is not a template.
-  class strstreambuf : public basic_streambuf<char, char_traits<char> >
+  class _GLIBCXX_IMPORT strstreambuf : public basic_streambuf<char, char_traits<char> >
   {
   public:
     // Types.
@@ -116,7 +116,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   };
 
   // Class istrstream, an istream that manages a strstreambuf.
-  class istrstream : public basic_istream<char>
+  class _GLIBCXX_IMPORT istrstream : public basic_istream<char>
   {
   public:
     explicit istrstream(char*);
@@ -133,7 +133,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   };
 
   // Class ostrstream
-  class ostrstream : public basic_ostream<char>
+  class _GLIBCXX_IMPORT ostrstream : public basic_ostream<char>
   {
   public:
     ostrstream();
@@ -150,7 +150,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   };
 
   // Class strstream
-  class strstream : public basic_iostream<char>
+  class _GLIBCXX_IMPORT strstream : public basic_iostream<char>
   {
   public:
     typedef char                        char_type;
Index: libstdc++-v3/libsupc++/typeinfo
===================================================================
--- libstdc++-v3/libsupc++/typeinfo	(revision 151124)
+++ libstdc++-v3/libsupc++/typeinfo	(working copy)
@@ -82,7 +82,7 @@ namespace std
    *  The @c type_info class describes type information generated by
    *  an implementation.
   */
-  class type_info 
+  class _GLIBCXX_IMPORT type_info 
   {
   public:
     /** Destructor first. Being the first non-inline virtual function, this
@@ -166,7 +166,7 @@ namespace std
    *
    *  If you attempt an invalid @c dynamic_cast expression, an instance of
    *  this class (or something derived from this class) is thrown.  */
-  class bad_cast : public exception 
+  class _GLIBCXX_IMPORT bad_cast : public exception
   {
   public:
     bad_cast() throw() { }
@@ -183,7 +183,7 @@ namespace std
    *  @brief Thrown when a NULL pointer in a @c typeid expression is used.
    *  @ingroup exceptions
    */
-  class bad_typeid : public exception 
+  class _GLIBCXX_IMPORT bad_typeid : public exception 
   {
   public:
     bad_typeid () throw() { }
Index: libstdc++-v3/libsupc++/exception
===================================================================
--- libstdc++-v3/libsupc++/exception	(revision 151124)
+++ libstdc++-v3/libsupc++/exception	(working copy)
@@ -56,7 +56,7 @@ namespace std
    *  your own %exception classes, or use a different hierarchy, or to
    *  throw non-class data (e.g., fundamental types).
    */
-  class exception 
+  class _GLIBCXX_IMPORT exception
   {
   public:
     exception() throw() { }
@@ -69,7 +69,7 @@ namespace std
 
   /** If an %exception is thrown which is not listed in a function's
    *  %exception specification, one of these may be thrown.  */
-  class bad_exception : public exception 
+  class _GLIBCXX_IMPORT bad_exception : public exception
   {
   public:
     bad_exception() throw() { }
Index: libstdc++-v3/libsupc++/new
===================================================================
--- libstdc++-v3/libsupc++/new	(revision 151124)
+++ libstdc++-v3/libsupc++/new	(working copy)
@@ -51,7 +51,7 @@ namespace std
    *
    *  @c bad_alloc (or classes derived from it) is used to report allocation
    *  errors from the throwing forms of @c new.  */
-  class bad_alloc : public exception 
+  class _GLIBCXX_IMPORT bad_alloc : public exception
   {
   public:
     bad_alloc() throw() { }
Index: libstdc++-v3/testsuite/lib/libstdc++.exp
===================================================================
--- libstdc++-v3/testsuite/lib/libstdc++.exp	(revision 151124)
+++ libstdc++-v3/testsuite/lib/libstdc++.exp	(working copy)
@@ -114,6 +114,9 @@ proc libstdc++_init { testfile } {
 	if { [string match "powerpc-*-darwin*" $target_triplet] } {
 	    append DEFAULT_CXXFLAGS " -multiply_defined suppress"
 	} 
+	if { [string match "*-*-cygwin*" $target_triplet] } {
+	    append DEFAULT_CXXFLAGS " -Wl,--enable-auto-import"
+	} 
     }
     v3track DEFAULT_CXXFLAGS 2
 
@@ -134,6 +137,9 @@ proc libstdc++_init { testfile } {
         set gccdir [file dirname $gccdir]
 	append ld_library_path_tmp ":${gccdir}"
     }
+    if { [string match "*-*-cygwin*" $target_triplet] } {
+	append ld_library_path_tmp ":${blddir}/../libgcc"
+    }
     v3track gccdir 3
 
     # Locate libgomp. This is only required for parallel mode.
Index: libstdc++-v3/config/os/newlib/os_defines.h
===================================================================
--- libstdc++-v3/config/os/newlib/os_defines.h	(revision 151124)
+++ libstdc++-v3/config/os/newlib/os_defines.h	(working copy)
@@ -38,6 +38,13 @@
 
 // See libstdc++/20806.
 #define _GLIBCXX_HAVE_DOS_BASED_FILESYSTEM 1
+
+#ifdef _GLIBCXX_DLL
+#define _GLIBCXX_IMPORT __attribute__((dllimport))
+#else
+#define _GLIBCXX_IMPORT
 #endif
 
 #endif
+
+#endif
Index: libstdc++-v3/config/os/mingw32/os_defines.h
===================================================================
--- libstdc++-v3/config/os/mingw32/os_defines.h	(revision 151124)
+++ libstdc++-v3/config/os/mingw32/os_defines.h	(working copy)
@@ -51,4 +51,10 @@
 // See  libstdc++/37522.
 #define _GLIBCXX_HAVE_BROKEN_VSWPRINTF 1
 
+#ifdef _GLIBCXX_DLL
+#define _GLIBCXX_IMPORT __attribute__((dllimport))
+#else
+#define _GLIBCXX_IMPORT
 #endif
+
+#endif

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Build libstdc++ as a DLL on Windows, updated for new  autotools.
  2009-09-03  4:06 ` Dave Korn
@ 2009-09-08  4:03   ` Dave Korn
  0 siblings, 0 replies; 4+ messages in thread
From: Dave Korn @ 2009-09-08  4:03 UTC (permalink / raw)
  To: Dave Korn; +Cc: GCC Patches, libstdc++, Benjamin Kosnik

[-- Attachment #1: Type: text/plain, Size: 6337 bytes --]

Dave Korn wrote:
> Dave Korn wrote:
>> [ refs:   The original series of patches at
>>   [0/4]  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01042.html
>>   [1/4]  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01044.html
>>   [2/4]  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01046.html
>>   [3/4]  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01047.html
>>   [4/4]  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01048.html
>>  and the tweaked respin at
>>          http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01631.html
>>  and the updated tweaked respin at
>>          http://gcc.gnu.org/ml/gcc-patches/2009-08/msg00877.html
>    and the updated updated tweaked respin at
>            http://gcc.gnu.org/ml/gcc-patches/2009-08/msg01570.html
     and the tweaked updated updated tweaked respin at
             http://gcc.gnu.org/ml/gcc-patches/2009-09/msg00210.html ]

  Last time, ...

>   Ben found that a bug had crept into this patch at some stage during
> development in the case of configuring GCC against an old version of the
> Cygwin DLL that doesn't provide the support required by the new libstdc++ DLL
> for C++ operator new/delete function replacement.  A careless tweak to the way
> the spec line is assembled from macros left an invalid empty colon hanging around.

  Well, after testing, turned out that the fix needed a fix, so here it is.
Only change from last time is to remove the "C++" option from the new
command-line flag in gcc/config/i386/cygming.opt.

  Bootstrapped on i686-pc-cygwin vs. Cygwin 1.7 and 1.5, verified that the
command-line switches work and the specs are correctly defaulted.  Ran the g++
and libstdc++ testsuites on 1.7 with no regressions, results at
http://gcc.gnu.org/ml/gcc-testresults/2009-09/msg00644.html.  ChangeLog
unchanged from before:

gcc/ChangeLog:

	* configure.ac (USE_CYGWIN_LIBSTDCXX_WRAPPERS): Define to reflect
	status of AC_CHECK_FUNC for Cygwin DLL libstdc++ support wrappers.
	* configure: Regenerate.
	* config.in: Regenerate.

	* config/i386/cygwin.h (CXX_WRAP_SPEC_LIST): Define list of --wrap
	options for Cygwin DLL libstdc++ support wrappers.
	(CXX_WRAP_SPEC_OPT): Define spec to use wrappers or not by default
	according to defined value of USE_CYGWIN_LIBSTDCXX_WRAPPERS.
	(CXX_WRAP_SPEC): Define entire wrapper spec in or out according to
	whether USE_CYGWIN_LIBSTDCXX_WRAPPERS is even defined or not.
	(LINK_SPEC): Include CXX_WRAP_SPEC.
	* config/i386/cygming.opt (muse-libstdc-wrappers): New option for
	Cygwin targets. Update copyright year.

libstdc++-v3/ChangeLog:

	* src/Makefile.am (libstdc___la_LDFLAGS): Add -no-undefined and
	-bindir switches.
	* src/Makefile.in: Regenerate.

	* config/os/newlib/os_defines.h (_GLIBCXX_IMPORT): Define to
	dllimport when indicated by _GLIBCXX_DLL.
	* config/os/mingw32/os_defines.h (_GLIBCXX_IMPORT): Likewise.
	* include/bits/c++config (_GLIBCXX_IMPORT): Add empty definition
	for non-dllimport targets.

	* include/std/iostream (cin): Annotate with _GLIBCXX_IMPORT.
	(cout, cerr, clog): Likewise.
	* include/std/stdexcept (class logic_error, domain_error,
	invalid_argument, length_error, out_of_range, runtime_error,
	range_error, underflow_error): Likewise.
	* include/ext/concurrence.h (class __concurrence_lock_error,
	__concurrence_unlock_error): Likewise.
	* include/bits/locale_classes.tcc (template class collate<char>,
	collate_byname<char>, collate<wchar_t>,
	collate_byname<wchar_t>): Likewise.
	* include/bits/locale_facets.tcc (template class numpunct<char>,
	numpunct_byname<char>, num_get<char>, num_put<char>,
	ctype_byname<char>, numpunct<wchar_t>, numpunct_byname<wchar_t>,
	num_get<wchar_t>, num_put<wchar_t>, ctype_byname<wchar_t>): Likewise.
	* include/bits/locale_classes.h (class locale, facet, id, _Impl,
	locale::facet, locale::id, locale::_Impl): Likewise.
	* include/bits/locale_facets.h (template class ctype<char>,
	ctype<wchar_t>): Likewise.
	* include/bits/basic_ios.tcc (template class basic_ios<char>,
	basic_ios<wchar_t>): Likewise.
	* include/bits/ios_base.h (class ios_base, failure, Init): Likewise.
	* include/bits/istream.tcc (template class basic_istream<char>,
	basic_iostream<char>, basic_istream<wchar_t>,
	basic_iostream<wchar_t>): Likewise.
	* include/bits/codecvt.h (template class codecvt_byname<char, char,
	mbstate_t>, codecvt_byname<wchar_t, char, mbstate_t>): Likewise.
	* include/bits/ostream.tcc (template class basic_ostream<char>,
	basic_ostream<wchar_t>): Likewise.
	* include/bits/sstream.tcc (template class basic_stringbuf<char>,
	basic_istringstream<char>, basic_ostringstream<char>,
	basic_stringstream<char>, basic_stringbuf<wchar_t>,
	basic_istringstream<wchar_t>, basic_ostringstream<wchar_t>,
	basic_stringstream<wchar_t>): Likewise.
	* include/bits/basic_string.tcc (template class basic_string<char>,
	basic_string<wchar_t>, related overloaded operator<<, operator>>,
	getline): Likewise.
	* include/bits/locale_facets_nonio.tcc (template class
	moneypunct<char, false>, moneypunct<char, true>,
	moneypunct_byname<char, false>, moneypunct_byname<char, true>,
	money_get<char>, money_put<char>, __timepunct<char>, time_put<char>,
	time_put_byname<char>, time_get<char>, time_get_byname<char>,
	messages<char>, messages_byname<char>, moneypunct<wchar_t, false>,
	moneypunct<wchar_t, true>, moneypunct_byname<wchar_t, false>,
	moneypunct_byname<wchar_t, true>, money_get<wchar_t>,
	money_put<wchar_t>, __timepunct<wchar_t>, time_put<wchar_t>,
	time_put_byname<wchar_t>, time_get<wchar_t>, time_get_byname<wchar_t>,
	messages<wchar_t>, messages_byname<wchar_t>): Likewise.
	* include/bits/streambuf.tcc (template class basic_streambuf<char>,
	basic_streambuf<wchar_t>): Likewise.
	* include/bits/fstream.tcc (template class basic_filebuf<char>,
	basic_ifstream<char>, basic_ofstream<char>, basic_fstream<char>,
	basic_filebuf<wchar_t>, basic_ifstream<wchar_t>,
	basic_ofstream<wchar_t>, basic_fstream<wchar_t>): Likewise.
	* include/backward/strstream (class strstreambuf, istrstream,
	ostrstream, strstream): Likewise.
	* libsupc++/typeinfo (class type_info, bad_cast,
	bad_typeid): Likewise.
	* libsupc++/exception (class exception, bad_exception): Likewise.
	* libsupc++/new (class bad_alloc): Likewise.

	* testsuite/lib/libstdc++.exp (proc libstdc++_init): Adjust
	DEFAULT_CXXFLAGS and ld_library_path_tmp for Cygwin.


    cheers,
      DaveK


[-- Attachment #2: libstdc-dll-final-take-2.diff --]
[-- Type: text/x-c, Size: 35262 bytes --]

Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 151124)
+++ gcc/configure.ac	(working copy)
@@ -2971,6 +2971,19 @@ changequote(,)dnl
   i[34567]86-*-* | x86_64-*-*)
 changequote([,])dnl
     case $target_os in
+      cygwin*)
+	# Full C++ conformance when using a shared libstdc++-v3 requires some
+	# support from the Cygwin DLL, which in more recent versions exports
+	# wrappers to aid in interposing and redirecting operators new, delete,
+	# etc., as per n2800 #17.6.4.6 [replacement.functions].  Check if we
+	# are configuring for a version of Cygwin that exports the wrappers.
+	AC_CHECK_FUNC([__wrap__Znaj],[gcc_ac_cygwin_dll_wrappers=yes],[gcc_ac_cygwin_dll_wrappers=no])
+	AC_DEFINE_UNQUOTED(USE_CYGWIN_LIBSTDCXX_WRAPPERS,
+	  [`if test $gcc_ac_cygwin_dll_wrappers = yes; then echo 1; else echo 0; fi`],
+	  [Define if you want to generate code by default that assumes that the
+	   Cygwin DLL exports wrappers to support libstdc++ function replacement.])
+    esac
+    case $target_os in
       cygwin* | pe | mingw32*)
 	# Recent binutils allows the three-operand form of ".comm" on PE.  This
 	# definition is used unconditionally to initialise the default state of
Index: gcc/config/i386/cygwin.h
===================================================================
--- gcc/config/i386/cygwin.h	(revision 151124)
+++ gcc/config/i386/cygwin.h	(working copy)
@@ -85,9 +85,41 @@ along with GCC; see the file COPYING3.  If not see
   %{mwindows:-lgdi32 -lcomdlg32} \
   -luser32 -lkernel32 -ladvapi32 -lshell32"
 
+/* To implement C++ function replacement we always wrap the cxx
+   malloc-like operators.  See N2800 #17.6.4.6 [replacement.functions] */
+#define CXX_WRAP_SPEC_LIST "%{!static: %{!static-libstdc++: \
+  --wrap _Znwj \
+  --wrap _Znaj \
+  --wrap _ZdlPv \
+  --wrap _ZdaPv \
+  --wrap _ZnwjRKSt9nothrow_t \
+  --wrap _ZnajRKSt9nothrow_t \
+  --wrap _ZdlPvRKSt9nothrow_t \
+  --wrap _ZdaPvRKSt9nothrow_t \
+  }}"
+
+#if defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)
+
+#if USE_CYGWIN_LIBSTDCXX_WRAPPERS
+/* Default on, only explict -mno disables.  */
+#define CXX_WRAP_SPEC_OPT "!mno-use-libstdc-wrappers"
+#else
+/* Default off, only explict -m enables.  */
+#define CXX_WRAP_SPEC_OPT "muse-libstdc-wrappers"
+#endif
+
+#define CXX_WRAP_SPEC "%{" CXX_WRAP_SPEC_OPT ":" CXX_WRAP_SPEC_LIST "}"
+
+#else /* !defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)  */
+
+#define CXX_WRAP_SPEC ""
+
+#endif /* ?defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS) */
+
 #define LINK_SPEC "\
   %{mwindows:--subsystem windows} \
   %{mconsole:--subsystem console} \
+  " CXX_WRAP_SPEC " \
   %{shared: %{mdll: %eshared and mdll are not compatible}} \
   %{shared: --shared} %{mdll:--dll} \
   %{static:-Bstatic} %{!static:-Bdynamic} \
Index: gcc/config/i386/cygming.opt
===================================================================
--- gcc/config/i386/cygming.opt	(revision 151124)
+++ gcc/config/i386/cygming.opt	(working copy)
@@ -1,6 +1,6 @@
 ; Cygwin- and MinGW-specific options.
 
-; Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+; Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
 ;
 ; This file is part of GCC.
 ;
@@ -49,3 +49,7 @@ Create GUI application
 mpe-aligned-commons
 Target Var(use_pe_aligned_common) Init(HAVE_GAS_ALIGNED_COMM)
 Use the GNU extension to the PE format for aligned common data
+
+muse-libstdc-wrappers
+Target Condition({defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)})
+Compile code that relies on Cygwin DLL wrappers to support C++ operator new/delete replacement
Index: libstdc++-v3/src/Makefile.am
===================================================================
--- libstdc++-v3/src/Makefile.am	(revision 151124)
+++ libstdc++-v3/src/Makefile.am	(working copy)
@@ -207,7 +207,8 @@ libstdc___la_DEPENDENCIES = \
 	$(top_builddir)/libsupc++/libsupc++convenience.la
 
 libstdc___la_LDFLAGS = \
-	-version-info $(libtool_VERSION) ${version_arg} -lm 
+	-version-info $(libtool_VERSION) ${version_arg} -lm \
+	-no-undefined -bindir $(bindir)
 
 # Use special rules for the deprecated source files so that they find
 # deprecated include files.
Index: libstdc++-v3/include/std/iostream
===================================================================
--- libstdc++-v3/include/std/iostream	(revision 151124)
+++ libstdc++-v3/include/std/iostream	(working copy)
@@ -55,16 +55,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  termination.  For more information, see the HOWTO linked to above.
   */
   //@{
-  extern istream cin;		///< Linked to standard input
-  extern ostream cout;		///< Linked to standard output
-  extern ostream cerr;		///< Linked to standard error (unbuffered)
-  extern ostream clog;		///< Linked to standard error (buffered)
+  extern _GLIBCXX_IMPORT istream cin;		///< Linked to standard input
+  extern _GLIBCXX_IMPORT ostream cout;		///< Linked to standard output
+  extern _GLIBCXX_IMPORT ostream cerr;		///< Linked to standard error (unbuffered)
+  extern _GLIBCXX_IMPORT ostream clog;		///< Linked to standard error (buffered)
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern wistream wcin;		///< Linked to standard input
-  extern wostream wcout;	///< Linked to standard output
-  extern wostream wcerr;	///< Linked to standard error (unbuffered)
-  extern wostream wclog;	///< Linked to standard error (buffered)
+  extern _GLIBCXX_IMPORT wistream wcin;		///< Linked to standard input
+  extern _GLIBCXX_IMPORT wostream wcout;	///< Linked to standard output
+  extern _GLIBCXX_IMPORT wostream wcerr;	///< Linked to standard error (unbuffered)
+  extern _GLIBCXX_IMPORT wostream wclog;	///< Linked to standard error (buffered)
 #endif
   //@}
 
Index: libstdc++-v3/include/std/stdexcept
===================================================================
--- libstdc++-v3/include/std/stdexcept	(revision 151124)
+++ libstdc++-v3/include/std/stdexcept	(working copy)
@@ -50,7 +50,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  program runs (e.g., violations of class invariants).
    *  @brief One of two subclasses of exception.
    */
-  class logic_error : public exception 
+  class _GLIBCXX_IMPORT logic_error : public exception
   {
     string _M_msg;
 
@@ -70,14 +70,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   /** Thrown by the library, or by you, to report domain errors (domain in
    *  the mathematical sense).  */
-  class domain_error : public logic_error 
+  class _GLIBCXX_IMPORT domain_error : public logic_error
   {
   public:
     explicit domain_error(const string& __arg);
   };
 
   /** Thrown to report invalid arguments to functions.  */
-  class invalid_argument : public logic_error 
+  class _GLIBCXX_IMPORT invalid_argument : public logic_error
   {
   public:
     explicit invalid_argument(const string& __arg);
@@ -85,7 +85,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   /** Thrown when an object is constructed that would exceed its maximum
    *  permitted size (e.g., a basic_string instance).  */
-  class length_error : public logic_error 
+  class _GLIBCXX_IMPORT length_error : public logic_error
   {
   public:
     explicit length_error(const string& __arg);
@@ -93,7 +93,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   /** This represents an argument whose value is not within the expected
    *  range (e.g., boundary checks in basic_string).  */
-  class out_of_range : public logic_error 
+  class _GLIBCXX_IMPORT out_of_range : public logic_error
   {
   public:
     explicit out_of_range(const string& __arg);
@@ -104,7 +104,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  the program executes.
    *  @brief One of two subclasses of exception.
    */
-  class runtime_error : public exception 
+  class _GLIBCXX_IMPORT runtime_error : public exception
   {
     string _M_msg;
 
@@ -123,7 +123,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   };
 
   /** Thrown to indicate range errors in internal computations.  */
-  class range_error : public runtime_error 
+  class _GLIBCXX_IMPORT range_error : public runtime_error
   {
   public:
     explicit range_error(const string& __arg);
@@ -137,7 +137,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   };
 
   /** Thrown to indicate arithmetic underflow.  */
-  class underflow_error : public runtime_error 
+  class _GLIBCXX_IMPORT underflow_error : public runtime_error
   {
   public:
     explicit underflow_error(const string& __arg);
Index: libstdc++-v3/include/ext/concurrence.h
===================================================================
--- libstdc++-v3/include/ext/concurrence.h	(revision 151124)
+++ libstdc++-v3/include/ext/concurrence.h	(working copy)
@@ -60,7 +60,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 
   // NB: As this is used in libsupc++, need to only depend on
   // exception. No stdexception classes, no use of std::string.
-  class __concurrence_lock_error : public std::exception
+  class _GLIBCXX_IMPORT __concurrence_lock_error : public std::exception
   {
   public:
     virtual char const*
@@ -68,7 +68,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
     { return "__gnu_cxx::__concurrence_lock_error"; }
   };
 
-  class __concurrence_unlock_error : public std::exception
+  class _GLIBCXX_IMPORT __concurrence_unlock_error : public std::exception
   {
   public:
     virtual char const*
Index: libstdc++-v3/include/bits/locale_classes.tcc
===================================================================
--- libstdc++-v3/include/bits/locale_classes.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/locale_classes.tcc	(working copy)
@@ -241,8 +241,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class collate<char>;
-  extern template class collate_byname<char>;
+  extern template class _GLIBCXX_IMPORT collate<char>;
+  extern template class _GLIBCXX_IMPORT collate_byname<char>;
 
   extern template
     const collate<char>&
@@ -253,8 +253,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     has_facet<collate<char> >(const locale&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class collate<wchar_t>;
-  extern template class collate_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT collate<wchar_t>;
+  extern template class _GLIBCXX_IMPORT collate_byname<wchar_t>;
 
   extern template
     const collate<wchar_t>&
Index: libstdc++-v3/include/bits/locale_facets.tcc
===================================================================
--- libstdc++-v3/include/bits/locale_facets.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/locale_facets.tcc	(working copy)
@@ -1276,11 +1276,11 @@ _GLIBCXX_END_LDBL_NAMESPACE
   // which are defined via explicit instantiations elsewhere.
   // NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class numpunct<char>;
-  extern template class numpunct_byname<char>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE num_get<char>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE num_put<char>;
-  extern template class ctype_byname<char>;
+  extern template class _GLIBCXX_IMPORT numpunct<char>;
+  extern template class _GLIBCXX_IMPORT numpunct_byname<char>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE num_get<char>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE num_put<char>;
+  extern template class _GLIBCXX_IMPORT ctype_byname<char>;
 
   extern template
     const ctype<char>&
@@ -1315,11 +1315,11 @@ _GLIBCXX_END_LDBL_NAMESPACE
     has_facet<num_get<char> >(const locale&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class numpunct<wchar_t>;
-  extern template class numpunct_byname<wchar_t>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE num_get<wchar_t>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE num_put<wchar_t>;
-  extern template class ctype_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT numpunct<wchar_t>;
+  extern template class _GLIBCXX_IMPORT numpunct_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE num_get<wchar_t>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE num_put<wchar_t>;
+  extern template class _GLIBCXX_IMPORT ctype_byname<wchar_t>;
 
   extern template
     const ctype<wchar_t>&
Index: libstdc++-v3/include/bits/locale_classes.h
===================================================================
--- libstdc++-v3/include/bits/locale_classes.h	(revision 151124)
+++ libstdc++-v3/include/bits/locale_classes.h	(working copy)
@@ -58,7 +58,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  This library supports efficient construction and copying of locales
    *  through a reference counting implementation of the locale class.
   */
-  class locale
+  class _GLIBCXX_IMPORT locale
   {
   public:
     // Types:
@@ -66,9 +66,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     typedef int	category;
 
     // Forward decls and friends:
-    class facet;
-    class id;
-    class _Impl;
+    class _GLIBCXX_IMPORT facet;
+    class _GLIBCXX_IMPORT id;
+    class _GLIBCXX_IMPORT _Impl;
 
     friend class facet;
     friend class _Impl;
@@ -332,7 +332,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *
    *  Facets may not be copied or assigned.
   */
-  class locale::facet
+  class _GLIBCXX_IMPORT locale::facet
   {
   private:
     friend class locale;
@@ -426,7 +426,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  cannot be used in a locale.  The locale::id ensures that each class
    *  type gets a unique identifier.
   */
-  class locale::id
+  class _GLIBCXX_IMPORT locale::id
   {
   private:
     friend class locale;
@@ -465,7 +465,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
 
   // Implementation object for locale.
-  class locale::_Impl
+  class _GLIBCXX_IMPORT locale::_Impl
   {
   public:
     // Friends.
Index: libstdc++-v3/include/bits/locale_facets.h
===================================================================
--- libstdc++-v3/include/bits/locale_facets.h	(revision 151124)
+++ libstdc++-v3/include/bits/locale_facets.h	(working copy)
@@ -671,7 +671,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  optimizations as well.
   */
   template<>
-    class ctype<char> : public locale::facet, public ctype_base
+    class _GLIBCXX_IMPORT ctype<char> : public locale::facet, public ctype_base
     {
     public:
       // Types:
@@ -1172,7 +1172,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  __ctype_abstract_base<wchar_t>.
   */
   template<>
-    class ctype<wchar_t> : public __ctype_abstract_base<wchar_t>
+    class _GLIBCXX_IMPORT ctype<wchar_t> : public __ctype_abstract_base<wchar_t>
     {
     public:
       // Types:
Index: libstdc++-v3/include/bits/basic_ios.tcc
===================================================================
--- libstdc++-v3/include/bits/basic_ios.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/basic_ios.tcc	(working copy)
@@ -175,10 +175,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_ios<char>;
+  extern template class _GLIBCXX_IMPORT basic_ios<char>;
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_ios<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_ios<wchar_t>;
 #endif
 #endif
 
Index: libstdc++-v3/include/bits/ios_base.h
===================================================================
--- libstdc++-v3/include/bits/ios_base.h	(revision 151124)
+++ libstdc++-v3/include/bits/ios_base.h	(working copy)
@@ -204,7 +204,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  people will only see @c ios_base when they need to specify the full
    *  name of the various I/O flags (e.g., the openmodes).
   */
-  class ios_base
+  class _GLIBCXX_IMPORT ios_base
   {
   public:
 
@@ -214,7 +214,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
      *
      *  27.4.2.1.1  Class ios_base::failure
      */
-    class failure : public exception
+    class _GLIBCXX_IMPORT failure : public exception
     {
     public:
       // _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -534,7 +534,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     // Used to initialize standard streams. In theory, g++ could use
     // -finit-priority to order this stuff correctly without going
     // through these machinations.
-    class Init
+    class _GLIBCXX_IMPORT Init
     {
       friend class ios_base;
     public:
Index: libstdc++-v3/include/bits/istream.tcc
===================================================================
--- libstdc++-v3/include/bits/istream.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/istream.tcc	(working copy)
@@ -1018,7 +1018,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_istream<char>;
+  extern template class _GLIBCXX_IMPORT basic_istream<char>;
   extern template istream& ws(istream&);
   extern template istream& operator>>(istream&, char&);
   extern template istream& operator>>(istream&, char*);
@@ -1041,10 +1041,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   extern template istream& istream::_M_extract(long double&);
   extern template istream& istream::_M_extract(void*&);
 
-  extern template class basic_iostream<char>;
+  extern template class _GLIBCXX_IMPORT basic_iostream<char>;
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_istream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_istream<wchar_t>;
   extern template wistream& ws(wistream&);
   extern template wistream& operator>>(wistream&, wchar_t&);
   extern template wistream& operator>>(wistream&, wchar_t*);
@@ -1063,7 +1063,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   extern template wistream& wistream::_M_extract(long double&);
   extern template wistream& wistream::_M_extract(void*&);
 
-  extern template class basic_iostream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_iostream<wchar_t>;
 #endif
 #endif
 
Index: libstdc++-v3/include/bits/codecvt.h
===================================================================
--- libstdc++-v3/include/bits/codecvt.h	(revision 151124)
+++ libstdc++-v3/include/bits/codecvt.h	(working copy)
@@ -469,7 +469,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class codecvt_byname<char, char, mbstate_t>;
+  extern template class _GLIBCXX_IMPORT codecvt_byname<char, char, mbstate_t>;
 
   extern template
     const codecvt<char, char, mbstate_t>&
@@ -480,7 +480,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     has_facet<codecvt<char, char, mbstate_t> >(const locale&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class codecvt_byname<wchar_t, char, mbstate_t>;
+  extern template class _GLIBCXX_IMPORT codecvt_byname<wchar_t, char, mbstate_t>;
 
   extern template
     const codecvt<wchar_t, char, mbstate_t>&
Index: libstdc++-v3/include/bits/ostream.tcc
===================================================================
--- libstdc++-v3/include/bits/ostream.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/ostream.tcc	(working copy)
@@ -357,7 +357,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_ostream<char>;
+  extern template class _GLIBCXX_IMPORT basic_ostream<char>;
   extern template ostream& endl(ostream&);
   extern template ostream& ends(ostream&);
   extern template ostream& flush(ostream&);
@@ -380,7 +380,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   extern template ostream& ostream::_M_insert(const void*);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_ostream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_ostream<wchar_t>;
   extern template wostream& endl(wostream&);
   extern template wostream& ends(wostream&);
   extern template wostream& flush(wostream&);
Index: libstdc++-v3/include/bits/sstream.tcc
===================================================================
--- libstdc++-v3/include/bits/sstream.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/sstream.tcc	(working copy)
@@ -255,16 +255,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_stringbuf<char>;
-  extern template class basic_istringstream<char>;
-  extern template class basic_ostringstream<char>;
-  extern template class basic_stringstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_stringbuf<char>;
+  extern template class _GLIBCXX_IMPORT basic_istringstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_ostringstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_stringstream<char>;
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_stringbuf<wchar_t>;
-  extern template class basic_istringstream<wchar_t>;
-  extern template class basic_ostringstream<wchar_t>;
-  extern template class basic_stringstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_stringbuf<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_istringstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_ostringstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_stringstream<wchar_t>;
 #endif
 #endif
 
Index: libstdc++-v3/include/bits/c++config
===================================================================
--- libstdc++-v3/include/bits/c++config	(revision 151124)
+++ libstdc++-v3/include/bits/c++config	(working copy)
@@ -334,4 +334,8 @@ _GLIBCXX_END_NAMESPACE
 # endif
 #endif
 
+#ifndef _GLIBCXX_IMPORT
+#define _GLIBCXX_IMPORT
+#endif
+
 // End of prewritten config; the discovered settings follow.
Index: libstdc++-v3/include/bits/basic_string.tcc
===================================================================
--- libstdc++-v3/include/bits/basic_string.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/basic_string.tcc	(working copy)
@@ -1130,32 +1130,32 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE > 0
-  extern template class basic_string<char>;
-  extern template
+  extern template class _GLIBCXX_IMPORT basic_string<char>;
+  extern template _GLIBCXX_IMPORT
     basic_istream<char>&
     operator>>(basic_istream<char>&, string&);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_ostream<char>&
     operator<<(basic_ostream<char>&, const string&);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_istream<char>&
     getline(basic_istream<char>&, string&, char);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_istream<char>&
     getline(basic_istream<char>&, string&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_string<wchar_t>;
-  extern template
+  extern template class _GLIBCXX_IMPORT basic_string<wchar_t>;
+  extern template _GLIBCXX_IMPORT
     basic_istream<wchar_t>&
     operator>>(basic_istream<wchar_t>&, wstring&);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_ostream<wchar_t>&
     operator<<(basic_ostream<wchar_t>&, const wstring&);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_istream<wchar_t>&
     getline(basic_istream<wchar_t>&, wstring&, wchar_t);
-  extern template
+  extern template _GLIBCXX_IMPORT
     basic_istream<wchar_t>&
     getline(basic_istream<wchar_t>&, wstring&);
 #endif
Index: libstdc++-v3/include/bits/locale_facets_nonio.tcc
===================================================================
--- libstdc++-v3/include/bits/locale_facets_nonio.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/locale_facets_nonio.tcc	(working copy)
@@ -1189,19 +1189,19 @@ _GLIBCXX_END_LDBL_NAMESPACE
   // which are defined via explicit instantiations elsewhere.
   // NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class moneypunct<char, false>;
-  extern template class moneypunct<char, true>;
-  extern template class moneypunct_byname<char, false>;
-  extern template class moneypunct_byname<char, true>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE money_get<char>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE money_put<char>;
-  extern template class __timepunct<char>;
-  extern template class time_put<char>;
-  extern template class time_put_byname<char>;
-  extern template class time_get<char>;
-  extern template class time_get_byname<char>;
-  extern template class messages<char>;
-  extern template class messages_byname<char>;
+  extern template class _GLIBCXX_IMPORT moneypunct<char, false>;
+  extern template class _GLIBCXX_IMPORT moneypunct<char, true>;
+  extern template class _GLIBCXX_IMPORT moneypunct_byname<char, false>;
+  extern template class _GLIBCXX_IMPORT moneypunct_byname<char, true>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE money_get<char>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE money_put<char>;
+  extern template class _GLIBCXX_IMPORT __timepunct<char>;
+  extern template class _GLIBCXX_IMPORT time_put<char>;
+  extern template class _GLIBCXX_IMPORT time_put_byname<char>;
+  extern template class _GLIBCXX_IMPORT time_get<char>;
+  extern template class _GLIBCXX_IMPORT time_get_byname<char>;
+  extern template class _GLIBCXX_IMPORT messages<char>;
+  extern template class _GLIBCXX_IMPORT messages_byname<char>;
 
   extern template
     const moneypunct<char, true>&
@@ -1264,19 +1264,19 @@ _GLIBCXX_END_LDBL_NAMESPACE
     has_facet<messages<char> >(const locale&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class moneypunct<wchar_t, false>;
-  extern template class moneypunct<wchar_t, true>;
-  extern template class moneypunct_byname<wchar_t, false>;
-  extern template class moneypunct_byname<wchar_t, true>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE money_get<wchar_t>;
-  extern template class _GLIBCXX_LDBL_NAMESPACE money_put<wchar_t>;
-  extern template class __timepunct<wchar_t>;
-  extern template class time_put<wchar_t>;
-  extern template class time_put_byname<wchar_t>;
-  extern template class time_get<wchar_t>;
-  extern template class time_get_byname<wchar_t>;
-  extern template class messages<wchar_t>;
-  extern template class messages_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT moneypunct<wchar_t, false>;
+  extern template class _GLIBCXX_IMPORT moneypunct<wchar_t, true>;
+  extern template class _GLIBCXX_IMPORT moneypunct_byname<wchar_t, false>;
+  extern template class _GLIBCXX_IMPORT moneypunct_byname<wchar_t, true>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE money_get<wchar_t>;
+  extern template class _GLIBCXX_IMPORT _GLIBCXX_LDBL_NAMESPACE money_put<wchar_t>;
+  extern template class _GLIBCXX_IMPORT __timepunct<wchar_t>;
+  extern template class _GLIBCXX_IMPORT time_put<wchar_t>;
+  extern template class _GLIBCXX_IMPORT time_put_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT time_get<wchar_t>;
+  extern template class _GLIBCXX_IMPORT time_get_byname<wchar_t>;
+  extern template class _GLIBCXX_IMPORT messages<wchar_t>;
+  extern template class _GLIBCXX_IMPORT messages_byname<wchar_t>;
 
   extern template
     const moneypunct<wchar_t, true>&
Index: libstdc++-v3/include/bits/streambuf.tcc
===================================================================
--- libstdc++-v3/include/bits/streambuf.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/streambuf.tcc	(working copy)
@@ -146,7 +146,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_streambuf<char>;
+  extern template class _GLIBCXX_IMPORT basic_streambuf<char>;
   extern template
     streamsize
     __copy_streambufs(basic_streambuf<char>*,
@@ -157,7 +157,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 			  basic_streambuf<char>*, bool&);
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_streambuf<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_streambuf<wchar_t>;
   extern template
     streamsize
     __copy_streambufs(basic_streambuf<wchar_t>*,
Index: libstdc++-v3/include/bits/fstream.tcc
===================================================================
--- libstdc++-v3/include/bits/fstream.tcc	(revision 151124)
+++ libstdc++-v3/include/bits/fstream.tcc	(working copy)
@@ -908,16 +908,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   // which are defined via explicit instantiations elsewhere.
   // NB:  This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE
-  extern template class basic_filebuf<char>;
-  extern template class basic_ifstream<char>;
-  extern template class basic_ofstream<char>;
-  extern template class basic_fstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_filebuf<char>;
+  extern template class _GLIBCXX_IMPORT basic_ifstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_ofstream<char>;
+  extern template class _GLIBCXX_IMPORT basic_fstream<char>;
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  extern template class basic_filebuf<wchar_t>;
-  extern template class basic_ifstream<wchar_t>;
-  extern template class basic_ofstream<wchar_t>;
-  extern template class basic_fstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_filebuf<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_ifstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_ofstream<wchar_t>;
+  extern template class _GLIBCXX_IMPORT basic_fstream<wchar_t>;
 #endif
 #endif
 
Index: libstdc++-v3/include/backward/strstream
===================================================================
--- libstdc++-v3/include/backward/strstream	(revision 151124)
+++ libstdc++-v3/include/backward/strstream	(working copy)
@@ -54,7 +54,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   // Class strstreambuf, a streambuf class that manages an array of char.
   // Note that this class is not a template.
-  class strstreambuf : public basic_streambuf<char, char_traits<char> >
+  class _GLIBCXX_IMPORT strstreambuf : public basic_streambuf<char, char_traits<char> >
   {
   public:
     // Types.
@@ -116,7 +116,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   };
 
   // Class istrstream, an istream that manages a strstreambuf.
-  class istrstream : public basic_istream<char>
+  class _GLIBCXX_IMPORT istrstream : public basic_istream<char>
   {
   public:
     explicit istrstream(char*);
@@ -133,7 +133,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   };
 
   // Class ostrstream
-  class ostrstream : public basic_ostream<char>
+  class _GLIBCXX_IMPORT ostrstream : public basic_ostream<char>
   {
   public:
     ostrstream();
@@ -150,7 +150,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   };
 
   // Class strstream
-  class strstream : public basic_iostream<char>
+  class _GLIBCXX_IMPORT strstream : public basic_iostream<char>
   {
   public:
     typedef char                        char_type;
Index: libstdc++-v3/libsupc++/typeinfo
===================================================================
--- libstdc++-v3/libsupc++/typeinfo	(revision 151124)
+++ libstdc++-v3/libsupc++/typeinfo	(working copy)
@@ -82,7 +82,7 @@ namespace std
    *  The @c type_info class describes type information generated by
    *  an implementation.
   */
-  class type_info 
+  class _GLIBCXX_IMPORT type_info 
   {
   public:
     /** Destructor first. Being the first non-inline virtual function, this
@@ -166,7 +166,7 @@ namespace std
    *
    *  If you attempt an invalid @c dynamic_cast expression, an instance of
    *  this class (or something derived from this class) is thrown.  */
-  class bad_cast : public exception 
+  class _GLIBCXX_IMPORT bad_cast : public exception
   {
   public:
     bad_cast() throw() { }
@@ -183,7 +183,7 @@ namespace std
    *  @brief Thrown when a NULL pointer in a @c typeid expression is used.
    *  @ingroup exceptions
    */
-  class bad_typeid : public exception 
+  class _GLIBCXX_IMPORT bad_typeid : public exception 
   {
   public:
     bad_typeid () throw() { }
Index: libstdc++-v3/libsupc++/exception
===================================================================
--- libstdc++-v3/libsupc++/exception	(revision 151124)
+++ libstdc++-v3/libsupc++/exception	(working copy)
@@ -56,7 +56,7 @@ namespace std
    *  your own %exception classes, or use a different hierarchy, or to
    *  throw non-class data (e.g., fundamental types).
    */
-  class exception 
+  class _GLIBCXX_IMPORT exception
   {
   public:
     exception() throw() { }
@@ -69,7 +69,7 @@ namespace std
 
   /** If an %exception is thrown which is not listed in a function's
    *  %exception specification, one of these may be thrown.  */
-  class bad_exception : public exception 
+  class _GLIBCXX_IMPORT bad_exception : public exception
   {
   public:
     bad_exception() throw() { }
Index: libstdc++-v3/libsupc++/new
===================================================================
--- libstdc++-v3/libsupc++/new	(revision 151124)
+++ libstdc++-v3/libsupc++/new	(working copy)
@@ -51,7 +51,7 @@ namespace std
    *
    *  @c bad_alloc (or classes derived from it) is used to report allocation
    *  errors from the throwing forms of @c new.  */
-  class bad_alloc : public exception 
+  class _GLIBCXX_IMPORT bad_alloc : public exception
   {
   public:
     bad_alloc() throw() { }
Index: libstdc++-v3/testsuite/lib/libstdc++.exp
===================================================================
--- libstdc++-v3/testsuite/lib/libstdc++.exp	(revision 151124)
+++ libstdc++-v3/testsuite/lib/libstdc++.exp	(working copy)
@@ -114,6 +114,9 @@ proc libstdc++_init { testfile } {
 	if { [string match "powerpc-*-darwin*" $target_triplet] } {
 	    append DEFAULT_CXXFLAGS " -multiply_defined suppress"
 	} 
+	if { [string match "*-*-cygwin*" $target_triplet] } {
+	    append DEFAULT_CXXFLAGS " -Wl,--enable-auto-import"
+	} 
     }
     v3track DEFAULT_CXXFLAGS 2
 
@@ -134,6 +137,9 @@ proc libstdc++_init { testfile } {
         set gccdir [file dirname $gccdir]
 	append ld_library_path_tmp ":${gccdir}"
     }
+    if { [string match "*-*-cygwin*" $target_triplet] } {
+	append ld_library_path_tmp ":${blddir}/../libgcc"
+    }
     v3track gccdir 3
 
     # Locate libgomp. This is only required for parallel mode.
Index: libstdc++-v3/config/os/newlib/os_defines.h
===================================================================
--- libstdc++-v3/config/os/newlib/os_defines.h	(revision 151124)
+++ libstdc++-v3/config/os/newlib/os_defines.h	(working copy)
@@ -38,6 +38,13 @@
 
 // See libstdc++/20806.
 #define _GLIBCXX_HAVE_DOS_BASED_FILESYSTEM 1
+
+#ifdef _GLIBCXX_DLL
+#define _GLIBCXX_IMPORT __attribute__((dllimport))
+#else
+#define _GLIBCXX_IMPORT
 #endif
 
 #endif
+
+#endif
Index: libstdc++-v3/config/os/mingw32/os_defines.h
===================================================================
--- libstdc++-v3/config/os/mingw32/os_defines.h	(revision 151124)
+++ libstdc++-v3/config/os/mingw32/os_defines.h	(working copy)
@@ -51,4 +51,10 @@
 // See  libstdc++/37522.
 #define _GLIBCXX_HAVE_BROKEN_VSWPRINTF 1
 
+#ifdef _GLIBCXX_DLL
+#define _GLIBCXX_IMPORT __attribute__((dllimport))
+#else
+#define _GLIBCXX_IMPORT
 #endif
+
+#endif

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-09-08  4:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-28 23:21 [PATCH] Build libstdc++ as a DLL on Windows, updated for new autotools Dave Korn
2009-08-31 21:43 ` Dave Korn
2009-09-03  4:06 ` Dave Korn
2009-09-08  4:03   ` Dave Korn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).