This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: weak symbols on Cygwin
On 4/7/2010 5:06 AM, Bruno Haible 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);
>
> This code breaks in Cygwin 1.7, because the autoconf test determines that gcc
> accepts #pragma weak. Not a big problem - I can surround that code with
> #ifdef __ELF__
And on cygwin, since the pthread functionality is IN cygwin1.dll, you
can never link a cygwin-based DLL or EXE without having the pthread
symbols present. So, if you want to support "with threading" vs.
"without threading" on cygwin, you have to have a configure time option,
instead:
#ifdef __ELF__
bool pthread_in_use = (pthread_cancel != NULL);
#elif defined(__CYGWIN__) and !defined(NO_THREADS)
bool pthread_in_use = true;
#else
bool pthread_in_use = false;
#endif
or something.
--
Chuck
--
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