This is the mail archive of the
mailing list for the pthreas-win32 project.
Re: feature request: not need to specify PTW32_STATIC_LIB for static usage possible ?
- From: Ross Johnson <Ross dot Johnson at homemail dot com dot au>
- To: pthreads-win32 at sourceware dot org
- Date: Fri, 01 Nov 2013 11:56:34 +1100
- Subject: Re: feature request: not need to specify PTW32_STATIC_LIB for static usage possible ?
- Authentication-results: sourceware.org; auth=none
- References: <CAL1QdWdtDy3zNY0hrGiyhj_Kk1aHdnJJFJinATB0Y0KECCnmdg at mail dot gmail dot com> <5122CF4E dot 1050301 at homemail dot com dot au> <CAL1QdWcyU76396H_RzXNBMAf7QFrmtC_Ab7ajC=TzG43QJm7fQ at mail dot gmail dot com> <51242375 dot 1070904 at homemail dot com dot au> <CAL1QdWck9rJaG6pQN8r28fJA293ydT1rw_EeLNfZafv1D7jMCA at mail dot gmail dot com> <CAL1QdWdLGhGttZqYSjN=U0TBkc-NJx=sao9xpFYtVf3hgrZ2jA at mail dot gmail dot com>
On 1/11/2013 6:46 AM, Roger Pack wrote:
On 2/20/13, Roger Pack <email@example.com> 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'
I'll admit that it is a bit frustrating to have to do
for anything that ends up using pthreads...
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