From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 65686 invoked by alias); 11 Apr 2015 19:21:21 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 65673 invoked by uid 89); 11 Apr 2015 19:21:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.8 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_COUK,SPF_PASS autolearn=no version=3.3.2 X-HELO: out.ipsmtp4nec.opaltelecom.net Received: from out.ipsmtp4nec.opaltelecom.net (HELO out.ipsmtp4nec.opaltelecom.net) (62.24.202.76) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Sat, 11 Apr 2015 19:21:19 +0000 X-SMTPAUTH: drstacey@tiscali.co.uk X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2CWAQCvcylV/4xZ0lUNT4NeXMY7hXwDAgKBfQEBAQEBAYUdAQEBAwE4QAYLCxgJFg8JAwIBAgFFEwgBAReIBxW1UZceAQEBAQYBAQEBAQEYBIsrhQMWhBcFjnKGE4czhhyNM4IlHIFRbgGCQgEBAQ X-IPAS-Result: A2CWAQCvcylV/4xZ0lUNT4NeXMY7hXwDAgKBfQEBAQEBAYUdAQEBAwE4QAYLCxgJFg8JAwIBAgFFEwgBAReIBxW1UZceAQEBAQYBAQEBAQEYBIsrhQMWhBcFjnKGE4czhhyNM4IlHIFRbgGCQgEBAQ Received: from 85-210-89-140.dynamic.dsl.as9105.com (HELO [192.168.1.2]) ([85.210.89.140]) by out.ipsmtp4nec.opaltelecom.net with ESMTP; 11 Apr 2015 20:21:15 +0100 Message-ID: <5529742A.7000902@tiscali.co.uk> Date: Sat, 11 Apr 2015 19:21:00 -0000 From: David Stacey User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: static vs. shared linking References: <5510A9AB.7020607@tiscali.co.uk> <5511AF73.9070607@tiscali.co.uk> <20150325090453.GB3017@calimero.vinschen.de> <551339E4.60705@tiscali.co.uk> <20150330105529.GJ29875@calimero.vinschen.de> <5519A0E1.6020707@tiscali.co.uk> <20150331090527.GB32403@calimero.vinschen.de> <551ACCE2.3000103@tiscali.co.uk> <5526351D.2000307@tiscali.co.uk> <5526EFDE.4090901@cygwin.com> In-Reply-To: <5526EFDE.4090901@cygwin.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00223.txt.bz2 On 09/04/15 22:32, Larry Hall (Cygwin) wrote: > On 04/09/2015 04:15 AM, David Stacey wrote: > > > >> I can't believe that I'm the first person to fall foul of this - any >> library >> that relies heavily on templates risks falling into the same trap. > > > > It's true that someone using STL strings has the potential to see this > bug > but I doubt there are allot of template libraries out there pulling > the same > memory trick or doing so with the same catastrophic results. It's going to affect all templates that have a static member variable, where an instantiation of said template is passed across a DLL boundary. Maybe there aren't too many of those. > In addition, > this is not the first time this has come up as an issue (for Cygwin or > other > platforms) in one form or another. Here's a good reference: > > Wow - that was an interesting read, thank you! Obviously a different context, but most definitely the same problem. It looks as though I stumbled into a bear trap that's been around for at least ten years. > There they recommend the "--enable-fully-dynamic-string" flag as a > solution > for this particular problem but I agree if the "-frepo" will solve > this as > well, it's better because it manages templates better overall and aligns > with Linux behavior. I'm not sure I like '--enable-fully-dynamic-string', because it changes the API of std::string, and the two APIs are not interchangeable. So a library compiled with '--enable-fully-dynamic-string' can't be used with code that omitted that compiler option. You have to use it everywhere or not at all. Poco is a network-centric library for other programmes to use. If I were to use '--enable-fully-dynamic-string' in compiling Poco then that would force users of the Poco library to use that compiler option too. And if, at the same time, they tried to link against another C++ API that wasn't built that way then the code wouldn't link - or if it did link it would crash when run. So I either have to use '-frepo' or explicitly export the templates that Poco uses. '-frepo' might take longer to compile, and I suspect that it will force users of Poco to compile with '-frepo' as well. But it's guaranteed to catch other templates that I might have missed, and it will work with other C++ libraries that weren't built with '--enable-fully-dynamic-string'. So I'll stick with '-frepo'. Anyway, thanks again for the link - interesting stuff. Dave. -- 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