From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28403 invoked by alias); 1 Nov 2013 00:56:45 -0000 Mailing-List: contact pthreads-win32-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sourceware.org Received: (qmail 28389 invoked by uid 89); 1 Nov 2013 00:56:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 X-HELO: icp-osb-irony-out3.external.iinet.net.au Received: from icp-osb-irony-out3.external.iinet.net.au (HELO icp-osb-irony-out3.external.iinet.net.au) (203.59.1.219) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 01 Nov 2013 00:56:42 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgMFAPz6clLKN5yD/2dsb2JhbABZgwfAc4EjFnSCJQEBBTgbJRELDQsJFg8JAwIBAgEPKAENEwYCAQEXh1oDDrJwDYlrjF+CdxaEGAOWHgGIKCeDYIIOhTeBaIFS Received: from unknown (HELO mail05.grapevine.net.au) ([202.55.156.131]) by icp-osb-irony-out3.iinet.net.au with ESMTP; 01 Nov 2013 08:56:38 +0800 Received: from [180.200.175.3] (helo=[192.168.2.2]) by mail05.grapevine.net.au with esmtp (Exim 4.77) (envelope-from ) id 1Vc32U-0008K3-7g for pthreads-win32@sourceware.org; Fri, 01 Nov 2013 11:56:38 +1100 Message-ID: <5272FC42.5000501@homemail.com.au> Date: Fri, 01 Nov 2013 00:56:00 -0000 From: Ross Johnson User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: pthreads-win32@sourceware.org Subject: Re: feature request: not need to specify PTW32_STATIC_LIB for static usage possible ? References: <5122CF4E.1050301@homemail.com.au> <51242375.1070904@homemail.com.au> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2013/txt/msg00019.txt.bz2 On 1/11/2013 6:46 AM, Roger Pack wrote: > On 2/20/13, Roger Pack wrote: >>> Sounds like you wanted to address this to the list but I think you >>> replied only to me. >> oops, moving back on list...suggest the ML be modified so the default >> reply-to is the ML :) >> >>> In Linux, the usual 'static' qualifier on declarations controls >>> visibility, regardless of dynamic or static linking but is restricted to >>> a file (or perhaps more accurately a compilation unit). If this isn't >>> convenient then GCC 4 and above recognise __attribute__ >>> ((visibility("hidden"))), and also "#pragma GCC visibility >>> push(hidden)/#pragma GCC visibility pop" for block coverage in e.g. >>> header files. Otherwise everything is visible by default. >>> >>> So I believe GNU can build a Windows dynamic or static library using the >>> merged pthread.c after adding 'static' qualifiers where necessary, but I >>> don't know off-hand if this works for MSVS. If it does, i.e. replace the >>> need for _declspec(export/import), then we probably have a solution. > I saw this the other day in a script that installs win32-pthreads: > > for file in 'pthread.h' 'sched.h' 'semaphore.h'; do > ed -s "$prefix/include/$file" <<< $'g/ __declspec (dllexport)/s///g\nw\nq' > ed -s "$prefix/include/$file" <<< $'g/ __declspec (dllimport)/s///g\nw\nq' > done > > I'll admit that it is a bit frustrating to have to do > export CFLAGS=-DPTW32_STATIC_LIB > for anything that ends up using pthreads... > > FWIW. > -roger- The original intent was that the library would always be a DLL so the burden was placed on static link users to add the switch. I don't like having references to linkage mode in header files but IIRC couldn't avoid it, so if anyone does have a way of avoiding it I'd be interested.