This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PING^2.5months] Build libstdc++ as a DLL on Windows.


    Hi all,

  Stage 1 is imminently drawing to an end, so here once more and hopefully for
the final time, is the patch I've been repeatedly posting and keeping updated
to head since mid-July.  It's already been approved from the w32/i386 backend
and build machinery POV, and just needs an OK from a v3 maintainer.

  Ben K. expressed an interest in reviewing the patch, mentioning also that he
had some reservations; if I understood correctly, about the uglification of
adding the _GLIBCXX_IMPORT markup tag, and he wanted to explore a
visibility-based approach.  Unfortunately he got bogged down in build
environment difficulties, and I haven't heard back from him in a week now, so
I can only assume he's swamped in work or otherwise AFK in this matter, and am
posting the patch once more to try and scrounge up a bit more "maintainer
resource" :-)

  I don't know if he's close to getting his alternate approach working, but it
would be a real shame if yet another major release series of GCC goes out the
door still not supporting shared libstdc++ on Windows platforms, and we can
always take the annotations out again if a better way of doing it becomes
available, and indeed that would be a more minor change probably allowable in
stage 3, but right now this is a new feature and so I'd like to have it
approved as part of stage 1, even if we decide I shouldn't check it in
straight away until Ben has had a chance to get back to us.

  Bootstrapped on i686-pc-cygwin, tests are still running currently but there
is no reason to expect any change in the consistently positive results that
this patch has been showing since I first posted it two and a half months ago.

  Ok for head?

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.

	* gcc.c (LINK_COMMAND_SPEC): Allow and ignore -static-libstdc++
	similarly to -static.

gcc/cp/ChangeLog:

	* g++spec.c (SKIPOPT): Delete.
	(lang_specific_driver): Do not skip -static-libstdc++ option.

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

-- 
[ 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/msg00209.html
  and the tweaked tweaked updated updated tweaked respin at
          http://gcc.gnu.org/ml/gcc-patches/2009-09/msg00500.html ]
Index: gcc/configure
===================================================================
--- gcc/configure	(revision 152230)
+++ gcc/configure	(working copy)
@@ -22635,6 +22635,26 @@ fi
 
   i[34567]86-*-* | x86_64-*-*)
     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_fn_c_check_func "$LINENO" "__wrap__Znaj" "ac_cv_func___wrap__Znaj"
+if test "x$ac_cv_func___wrap__Znaj" = x""yes; then :
+  gcc_ac_cygwin_dll_wrappers=yes
+else
+  gcc_ac_cygwin_dll_wrappers=no
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define USE_CYGWIN_LIBSTDCXX_WRAPPERS `if test $gcc_ac_cygwin_dll_wrappers = yes; then echo 1; else echo 0; fi`
+_ACEOF
+
+    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/gcc.c
===================================================================
--- gcc/gcc.c	(revision 152230)
+++ gcc/gcc.c	(working copy)
@@ -760,7 +760,10 @@ proper position among the other output files.  */
 
 /* -u* was put back because both BSD and SysV seem to support it.  */
 /* %{static:} simply prevents an error message if the target machine
-   doesn't handle -static.  */
+   doesn't handle -static; %{static-libstdc++} is not handled by any
+   target machine but entirely in cp/g++spec.c, yet we cannot just
+   remove it from the command-line there or it cannot be tested in
+   spec processing, so we simply ignore it here similarly.  */
 /* We want %{T*} after %{L*} and %D so that it can be used to specify linker
    scripts which exist in user specified directories, or in standard
    directories.  */
@@ -769,7 +772,7 @@ proper position among the other output files.  */
 %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
     %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
     %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
-    %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
+    %{static:} %{static-libstdc++:} %{L*} %(mfwrap) %(link_libgcc) %o\
     %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)} %(mflib)\
     %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
     %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
Index: gcc/cp/g++spec.c
===================================================================
--- gcc/cp/g++spec.c	(revision 152230)
+++ gcc/cp/g++spec.c	(working copy)
@@ -30,8 +30,6 @@ along with GCC; see the file COPYING3.  If not see
 #define MATHLIB		(1<<2)
 /* This bit is set if they did `-lc'.  */
 #define WITHLIBC	(1<<3)
-/* Skip this option.  */
-#define SKIPOPT		(1<<4)
 
 #ifndef MATH_LIBRARY
 #define MATH_LIBRARY "-lm"
@@ -211,10 +209,7 @@ lang_specific_driver (int *in_argc, const char *co
 	  else if (strcmp (argv[i], "-static-libgcc") == 0)
 	    shared_libgcc = 0;
 	  else if (strcmp (argv[i], "-static-libstdc++") == 0)
-	    {
 	      library = library >= 0 ? 2 : library;
-	      args[i] |= SKIPOPT;
-	    }
 	  else if (DEFAULT_WORD_SWITCH_TAKES_ARG (&argv[i][1]))
 	    i++;
 	  else
@@ -324,9 +319,6 @@ lang_specific_driver (int *in_argc, const char *co
 	  arglist[j] = "-xnone";
 	}
 
-      if ((args[i] & SKIPOPT) != 0)
-	--j;
-
       i++;
       j++;
     }
Index: gcc/config.in
===================================================================
--- gcc/config.in	(revision 152230)
+++ gcc/config.in	(working copy)
@@ -1598,6 +1598,13 @@
 #endif
 
 
+/* Define if you want to generate code by default that assumes that the Cygwin
+   DLL exports wrappers to support libstdc++ function replacement. */
+#ifndef USED_FOR_TARGET
+#undef USE_CYGWIN_LIBSTDCXX_WRAPPERS
+#endif
+
+
 /* Define to 1 if the 'long long' (or '__int64') is wider than 'long' but
    still efficiently supported by the host hardware. */
 #ifndef USED_FOR_TARGET
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 152230)
+++ gcc/configure.ac	(working copy)
@@ -2978,6 +2978,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 152230)
+++ 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 152230)
+++ 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.in
===================================================================
--- libstdc++-v3/src/Makefile.in	(revision 152230)
+++ libstdc++-v3/src/Makefile.in	(working copy)
@@ -445,7 +445,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)
 
 libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS)
 
Index: libstdc++-v3/src/Makefile.am
===================================================================
--- libstdc++-v3/src/Makefile.am	(revision 152230)
+++ 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)
 
 libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS)
 
Index: libstdc++-v3/include/std/iostream
===================================================================
--- libstdc++-v3/include/std/iostream	(revision 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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 152230)
+++ 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]