This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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,

#ifdef __ELF__
bool pthread_in_use = (pthread_cancel != NULL);
#elif defined(__CYGWIN__) and !defined(NO_THREADS)
bool pthread_in_use = true;
bool pthread_in_use = false;

or something.


Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]