This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: weak symbols on Cygwin
- From: Bruno Haible <bruno at clisp dot org>
- To: Dave Korn <dave dot korn dot cygwin at googlemail dot com>, cygwin at cygwin dot com
- Cc: Eric Blake <eblake at redhat dot com>
- Date: Thu, 8 Apr 2010 01:14:39 +0200
- Subject: Re: weak symbols on Cygwin
- References: <4BBB31C6.7080703@redhat.com> <4BBCBADA.2090504@gmail.com> <4BBCBB14.4080908@redhat.com>
Dave Korn wrote:
>> I've got some code, written for ELF platforms, that detects whether the
>> pthread library (often a separate library from libc) is linked, by doing
>>
>> #pragma weak pthread_cancel
>> bool pthread_in_use = (pthread_cancel != NULL);
>
> And you really need to determine this dynamically at runtime rather than
> statically at configure time?
Sure. I want the same library (libintl) to be usable. on Unix,
1) by multithreaded programs, without bugs due to simultaneous access
to data by multiple threads,
2) by single-threaded programs, without putting on them the performance
price of linking with -lpthread.
"#pragma weak pthread_cancel" does exactly that.
Bruno
--
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