Index: boost/config/compiler/borland.hpp
===================================================================
--- boost/config/compiler/borland.hpp	(revision 62091)
+++ boost/config/compiler/borland.hpp	(working copy)
@@ -232,6 +232,8 @@
 //
 #ifndef __STRICT_ANSI__
 #  define BOOST_HAS_DECLSPEC
+#  define BOOST_SYMBOL_EXPORT __declspec(dllexport)
+#  define BOOST_SYMBOL_IMPORT __declspec(dllimport)
 #endif
 //
 // ABI fixing headers:
Index: boost/config/compiler/clang.hpp
===================================================================
--- boost/config/compiler/clang.hpp	(revision 62091)
+++ boost/config/compiler/clang.hpp	(working copy)
@@ -22,6 +22,8 @@
 // HACK: Clang only defines the type __int32 in Microsoft-compatibility mode,
 // which means that declspecs are also available
 #  define BOOST_HAS_DECLSPEC
+#  define BOOST_SYMBOL_EXPORT __declspec(dllexport)
+#  define BOOST_SYMBOL_IMPORT __declspec(dllimport)
 #endif
 
 #if defined(__int64)
Index: boost/config/compiler/codegear.hpp
===================================================================
--- boost/config/compiler/codegear.hpp	(revision 62091)
+++ boost/config/compiler/codegear.hpp	(working copy)
@@ -149,6 +149,8 @@
 //
 #if !defined(__STRICT_ANSI__)
 #  define BOOST_HAS_DECLSPEC
+#  define BOOST_SYMBOL_EXPORT __declspec(dllexport)
+#  define BOOST_SYMBOL_IMPORT __declspec(dllimport)
 #endif
 //
 // ABI fixing headers:
Index: boost/config/compiler/gcc.hpp
===================================================================
--- boost/config/compiler/gcc.hpp	(revision 62091)
+++ boost/config/compiler/gcc.hpp	(working copy)
@@ -108,7 +108,26 @@
 #if __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 )
 #define BOOST_HAS_NRVO
 #endif
+
 //
+// Dynamic shared object (DSO) and dynamic-link library (DLL) support
+//
+#if __GNUC__ >= 4
+#  define BOOST_HAS_DECLSPEC
+#  if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+     // All Win32 development environments, including 64-bit Windows and MinGW, define 
+     // _WIN32 or one of its variant spellings. Note that Cygwin is a POSIX environment,
+     // so does not define _WIN32 or its variants.
+#    define BOOST_SYMBOL_EXPORT __attribute__((dllexport))
+#    define BOOST_SYMBOL_IMPORT __attribute__((dllimport))
+#  else
+#    define BOOST_SYMBOL_EXPORT __attribute__((visibility("default")))
+#    define BOOST_SYMBOL_IMPORT
+#  endif
+#  define BOOST_SYMBOL_VISIBLE __attribute__((visibility("default")))
+#endif
+
+//
 // RTTI and typeinfo detection is possible post gcc-4.3:
 //
 #if __GNUC__ * 100 + __GNUC_MINOR__ >= 403
Index: boost/config/compiler/visualc.hpp
===================================================================
--- boost/config/compiler/visualc.hpp	(revision 62091)
+++ boost/config/compiler/visualc.hpp	(working copy)
@@ -164,10 +164,11 @@
 #  define BOOST_NO_RTTI
 #endif
 
+// all supported versions have __declspec:
 //
-// all versions support __declspec:
-//
 #define BOOST_HAS_DECLSPEC
+#define BOOST_SYMBOL_EXPORT __declspec(dllexport)
+#define BOOST_SYMBOL_IMPORT __declspec(dllimport)
 
 //
 // C++0x features
Index: boost/config/platform/win32.hpp
===================================================================
--- boost/config/platform/win32.hpp	(revision 62091)
+++ boost/config/platform/win32.hpp	(working copy)
@@ -21,10 +21,6 @@
 #  define BOOST_NO_SWPRINTF
 #endif
 
-#if !defined(__GNUC__) && !defined(BOOST_HAS_DECLSPEC)
-#  define BOOST_HAS_DECLSPEC
-#endif
-
 #if defined(__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 2) || ((__MINGW32_MAJOR_VERSION == 2) && (__MINGW32_MINOR_VERSION >= 0)))
 #  define BOOST_HAS_STDINT_H
 #  define __STDC_LIMIT_MACROS
Index: boost/system/config.hpp
===================================================================
--- boost/system/config.hpp	(revision 62091)
+++ boost/system/config.hpp	(working copy)
@@ -1,4 +1,4 @@
-//  boost/system/config.hpp  -------------------------------------------------//
+//  boost/system/config.hpp  -----------------------------------------------------------//
 
 //  Copyright Beman Dawes 2003, 2006
 
@@ -18,40 +18,37 @@
 # if defined( BOOST_WINDOWS_API ) && defined( BOOST_POSIX_API )
 #   error both BOOST_WINDOWS_API and BOOST_POSIX_API are defined
 # elif !defined( BOOST_WINDOWS_API ) && !defined( BOOST_POSIX_API )
-#   if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__)
+#   if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+      // All Win32 development environments, including 64-bit Windows and MinGW, define 
+      // _WIN32 or one of its variant spellings. Note that Cygwin is a POSIX environment,
+      // so does not define _WIN32 or its variants.
 #     define BOOST_WINDOWS_API
 #   else
 #     define BOOST_POSIX_API 
 #   endif
 # endif
 
-//  enable dynamic linking on Windows  ---------------------------------------//
+//  enable either dynamic or static linking  -------------------------------------------//
 
-//#  if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SYSTEM_DYN_LINK)) && defined(__BORLANDC__) && defined(__WIN32__)
-//#    error Dynamic linking Boost.System does not work for Borland; use static linking instead
-//#  endif
+//  define BOOST_SYSTEM_DECL
+#if defined(BOOST_HAS_DECLSPEC) && (defined(BOOST_ALL_DYN_LINK)||defined(BOOST_SYSTEM_DYN_LINK))
+# if defined(BOOST_SYSTEM_SOURCE)
+#   define BOOST_SYSTEM_DECL BOOST_SYMBOL_EXPORT
+# else 
+#   define BOOST_SYSTEM_DECL BOOST_SYMBOL_IMPORT
+# endif
+#else
+# define BOOST_SYSTEM_DECL
+#endif
 
-#ifdef BOOST_HAS_DECLSPEC // defined in config system
-// we need to import/export our code only if the user has specifically
-// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
-// libraries to be dynamically linked, or BOOST_SYSTEM_DYN_LINK
-// if they want just this one to be dynamically liked:
-#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SYSTEM_DYN_LINK)
-// export if this is our own source, otherwise import:
-#ifdef BOOST_SYSTEM_SOURCE
-# define BOOST_SYSTEM_DECL __declspec(dllexport)
+//  define BOOST_SYSTEM_VISIBLE
+#if defined(BOOST_SYMBOL_VISIBLE) && (defined(BOOST_ALL_DYN_LINK)||defined(BOOST_SYSTEM_DYN_LINK))
+# define BOOST_SYSTEM_VISIBLE BOOST_SYMBOL_VISIBLE
 #else
-# define BOOST_SYSTEM_DECL __declspec(dllimport)
-#endif  // BOOST_SYSTEM_SOURCE
-#endif  // DYN_LINK
-#endif  // BOOST_HAS_DECLSPEC
-//
-// if BOOST_SYSTEM_DECL isn't defined yet define it now:
-#ifndef BOOST_SYSTEM_DECL
-#define BOOST_SYSTEM_DECL
+# define BOOST_SYSTEM_VISIBLE
 #endif
 
-//  enable automatic library variant selection  ------------------------------// 
+//  enable automatic library variant selection  ----------------------------------------// 
 
 #if !defined(BOOST_SYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SYSTEM_NO_LIB)
 //
Index: boost/system/system_error.hpp
===================================================================
--- boost/system/system_error.hpp	(revision 62091)
+++ boost/system/system_error.hpp	(working copy)
@@ -17,9 +17,11 @@
 {
   namespace system
   {
-    //  class system_error  --------------------------------------------------//
+    //  class system_error  ------------------------------------------------------------//
 
-    class system_error : public std::runtime_error
+    class BOOST_SYSTEM_VISIBLE system_error : public std::runtime_error
+    // BOOST_SYSTEM_VISIBLE is needed by GCC to ensure system_error thrown from a DLL/DSO
+    // can be caught. See svn.boost.org/trac/boost/ticket/3697 
     {
     public:
       system_error( error_code ec )
Index: libs/config/doc/macro_reference.qbk
===================================================================
--- libs/config/doc/macro_reference.qbk	(revision 62091)
+++ libs/config/doc/macro_reference.qbk	(working copy)
@@ -317,6 +317,52 @@
 
 [#config_features]
 
+[section Macros controlling symbol visibility]
+
+Some compilers support C++ extensions that control which symbols 
+will be exported from shared libraries such as dynamic shared objects (DSO's) on Unix-like
+systems or dynamic-link libraries (DLL's) on Windows.
+
+The Microsoft VC++ compiler has long supplied 
+`__declspec(dllexport)` and `__declspec(dllimport)` extensions for this purpose,
+as do virtually all other compilers targeting the Windows platform.
+ 
+Modern versions of the GNU GCC compiler provide the `__attribute__((visibility("default")))` 
+extension to indicate that a symbol should be exported. All other symbols may be hidden by using the
+`-fvisibility-hidden` or `-fvisibility-ms-compat` compiler switches.
+
+Boost supplies several macros to make it easier to manage symbol visibility in a way that
+is portable between compilers and operating systems.
+
+[table
+[[Macro       ][Description       ]]
+[[`BOOST_HAS_DECLSPEC`][
+The compiler has C++ extensions such as `__declspec(dllexport)` and `__declspec(dllimport)` to
+export/import symbols from shared libraries. The BOOST_SYMBOL_EXPORT, BOOST_SYMBOL_IMPORT,
+or BOOST_SYMBOL_VISIBLE macros supply the extension syntax for the particular compiler.
+]]
+[[`BOOST_SYMBOL_EXPORT`][
+Defines the extension syntax, if any, that indicates a symbol is to be exported from a shared library.
+]]
+[[`BOOST_SYMBOL_IMPORT`][
+Defines the extension syntax, if any, that indicates a symbol is to be imported from a shared library.
+]]
+[[`BOOST_SYMBOL_VISIBLE`][
+Defines the extension syntax, if any, that indicates a symbol is to be globally visible.
+Needed for classes that are not otherwise exported, but are used by RTTI. Examples include
+class for objects that will be thrown as exceptions or used in dynamic_casts,
+across shared library boundaries. For example, a header-only exception class might look like this:
+``
+  class BOOST_SYMBOL_VISIBLE my_exception : public std::runtime_error { ... };
+`` 
+Without BOOST_SYMBOL_VISIBLE, it will be impossible to catch my_exception if thrown from a shared library
+compiled by GCC with the -fvisibility=hidden option.
+]]
+]
+
+[endsect]
+
+
 [section Macros that describe optional features]
 
 The following macros describe features that are not required by the C++
@@ -332,10 +378,6 @@
 [[`BOOST_HAS_CLOCK_GETTIME`][Platform][
 The platform has the POSIX API `clock_gettime`.
 ]]
-[[`BOOST_HAS_DECLSPEC`][Compiler][
-The compiler uses `__declspec(dllexport)` and `__declspec(dllimport)` to
-export/import symbols from dll's.
-]]
 [[`BOOST_HAS_DIRENT_H`][Platform][
 The platform has the POSIX header `<dirent.h>`.
 ]]
