X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 Date: Thu, 20 Aug 2009 16:54:51 +0200 Message-ID: Subject: mingw32 runtime library: msvcrt not thread safe. How to use msvcr90? From: =?UTF-8?B?RnLDqWTDqXJpYyBCcm9u?= To: cygwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Hi folks, I have a big issue with the C runtime library used when with -mno-cygwin option of g++: it looks to be non thread safe in the istream implementation. The simple program below crashes with segmentation fault when compiled in cygwin with option -mno-cygwin while it works perfectly when compiled with MSVC++ 2008. The difference is that the program compiled from cygwin is linked with msvcrt.dll while the one compiled from MSVC is linked with msvcr90.dll and msvcp90.dll. Do you know the difference between the libraries and why mingw32 uses a different one than MSVC? How can I use the same runtime library with gcc/g++ -mno-cygwin? I am using cygwin 1.5 on Windows XP. Fr=C3=A9d=C3=A9ric #include #include #include struct Task { void operator()() { for (size_t k=3D0 ; k<10000 ; ++k) { double x ; std::istringstream is("10.") ; is >> x ; } } } ; int main() { boost::thread_group g_thread ; for (size_t k=3D0 ; k<10 ; ++k) g_thread.create_thread(Task()) ; g_thread.join_all() ; return 0 ; } -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple