More fallout from namespace changes

Danny Smith
Sat Oct 12 16:45:00 GMT 2002

Recent changes to caused following error when building abi_check
on mingw32, which uses __GTHREAD_MUTEX_INIT_FUNCTION rather than

make[2]: Entering directory
LD_RUN_PATH=/develop/gcc/build/mingw32/libstdc++-v3/src/.libs /bin/sh
../libtool --tag=CXX --mode=link `echo /develop/gcc/build/gcc/xgcc
-shared-libgcc -B/develop/gcc/build/gcc/ -nostdinc++ 
-L/develop/gcc/build/mingw32/libstdc++-v3/src/.libs -B/mingw/mingw32/bin/
-B/mingw/mingw32/lib/ -isystem /mingw/mingw32/include  | sed
's/xgcc/g++/g'`  -O2  -o abi_check  abi_check.o  -lm
/develop/gcc/build/gcc/g++ -shared-libgcc -B/develop/gcc/build/gcc/
-nostdinc++ -B/mingw/mingw32/bin/ -B/mingw/mingw32/lib/ -isystem
/mingw/mingw32/include -O2 -o abi_check abi_check.o 
-L/develop/gcc/build/mingw32/libstdc++-v3/src/.libs -lm
undefined reference to `std::_GLIBCPP_mutex_address'
undefined reference to `std::_GLIBCPP_mutex'
undefined reference to `std::_GLIBCPP_mutex_address_init()'
undefined reference to `std::_GLIBCPP_mutex'
undefined reference to `std::_GLIBCPP_mutex_init()'
undefined reference to `std::_GLIBCPP_once'
make[2]: *** [abi_check] Error 1

The symbols are defined in namespace __gnu_cxx in but declared
namespace std in stl_threads.h.

The following fixes by, declaring in __gnu_cxx is stl_threads.h. An
alternative is to revert part of the change and define these in namespace
std in, as before.

2002-10-12  Danny Smith  <> 

	* include/bits/stl_threads.h (_GLIBCPP_mutex,
	_GLIBCPP_mutex_address_init, _GLIBCPP_once):
	Declare in namespace __gnu_cxx.

--- stl_threads.h.bak	Tue Dec 04 21:13:39 2001
+++ stl_threads.h	Sun Oct 13 00:04:27 2002
@@ -126,6 +126,7 @@ namespace std
     return __result;
+} //namespace std
   // Locking class.  Note that this class *does not have a
   // constructor*.  It must be initialized either statically, with
@@ -141,13 +142,26 @@ namespace std
   // functions, and no private or protected members.
 #if !defined(__GTHREAD_MUTEX_INIT) &&
+namespace __gnu_cxx
   extern __gthread_mutex_t _GLIBCPP_mutex;
   extern __gthread_mutex_t *_GLIBCPP_mutex_address;
   extern __gthread_once_t _GLIBCPP_once;
   extern void _GLIBCPP_mutex_init (void);
   extern void _GLIBCPP_mutex_address_init (void);
+namespace std
+  using __gnu_cxx::_GLIBCPP_mutex;
+  using __gnu_cxx::_GLIBCPP_mutex_address;
+  using __gnu_cxx::_GLIBCPP_once;
+  using __gnu_cxx::_GLIBCPP_mutex_init;
+  using __gnu_cxx::_GLIBCPP_mutex_address_init;
+namespace std
   struct _STL_mutex_lock
     // The class must be statically initialized with __STL_MUTEX_INITIALIZER. - Yahoo! Messenger for SMS
- Always be connected to your Messenger Friends

More information about the Libstdc++ mailing list