www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/04/07/08:35:14

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_LOW
X-Spam-Check-By: sourceware.org
Message-ID: <4BBC7BE3.7080409@cwilson.fastmail.fm>
Date: Wed, 07 Apr 2010 08:34:43 -0400
From: Charles Wilson <cygwin AT cwilson DOT fastmail DOT fm>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666
MIME-Version: 1.0
To: Cygwin Mailing List <cygwin AT cygwin DOT com>
Subject: Re: weak symbols on Cygwin
References: <4BBB31C6 DOT 7080703 AT redhat DOT com> <201004070141 DOT 36284 DOT bruno AT clisp DOT org> <4BBBF5C2 DOT 30102 AT gmail DOT com> <201004071106 DOT 11471 DOT bruno AT clisp DOT org>
In-Reply-To: <201004071106.11471.bruno@clisp.org>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019