Compilesinglestringquerystring assertion

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: r Linking with gcc 4.0.2 gives many unsats for member functions of class templates explicitly instantiated in the library. For example: gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -pthreads -D_RWSTD_USE_CONFIG -I/build/sebor/gcc-4.0.2-15s/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/examples/include -pedantic -nostdinc++ -g -Wall -W -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long /build/sebor/dev/stdlib/examples/tutorial/alg7.cpp gcc alg7.o -o alg7 -pthreads -L/build/sebor/gcc-4.0.2-15s/lib -lstd15s -lsupc++ -lm Undefined first referenced symbol in file std::basic_string<char, std::char_traits<char>, std::allocator<char> >::substr(unsigned int, unsigned int) constalg2.o ld: fatal: Symbol referencing errors. No output written to alg2 collect2: ld returned 1 exit status make: *** [alg2] Error 1 [MSVC] bad casts in __rw_atomic_xxx() functions '-------- Original Message -------- Subject: Problems in __rw_atomic_ operations for Win32 (_mutex.h) Date: Tue, 1 Nov 2005 19:49:49 +0300 From: Anton Pevtsov <AntonP@moscow.vdiweb.com> Reply-To: stdcxx-dev@incubator.apache.org To: <stdcxx-dev@incubator.apache.org> There is a problem in the __rw_atomic_preincrement function versions for Win32 (see the include\rw\_mutex.h file, line 1352): inline int __rw_atomic_preincrement (int &__x, bool) { _RWSTD_COMPILE_ASSERT (sizeof __x == sizeof (long)); return InterlockedIncrement (_RWSTD_REINTERPRET_CAST (long*, __x)); } This _RWSTD_REINTERPRET_CAST (long*, __x) tries to cast __x (not &__x !) to the long*. After the casting the created temporary variable (to be passed to the InterlockedIncrement function) contains the value of __x interpreted as an valid address. This results in that all stdcxx library examples crash. (They use std::cout which uses these functions ?) The same problem is in __rw_atomic_predecrement and __rw_atomic_exchange. Looks like instead of _RWSTD_REINTERPRET_CAST (long*, __x) should b...
View Full Document

Ask a homework question - tutors are online