From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7778 invoked by alias); 10 May 2010 19:50:48 -0000 Received: (qmail 7769 invoked by uid 22791); 10 May 2010 19:50:47 -0000 X-SWARE-Spam-Status: No, hits=0.8 required=5.0 tests=BAYES_50 X-Spam-Check-By: sourceware.org Received: from m57s08.vlinux.de (HELO m57s08.vlinux.de) (83.151.21.42) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 10 May 2010 19:50:41 +0000 Received: from localhost (dslb-084-061-105-232.pools.arcor-ip.net [84.61.105.232]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client CN "Martin Lambers", Issuer "Lambers" (verified OK)) by m57s08.vlinux.de (Postfix) with ESMTPSA id 3155E7C073; Mon, 10 May 2010 21:50:38 +0200 (CEST) Date: Mon, 10 May 2010 19:50:00 -0000 From: Martin Lambers To: pthreads-win32@sourceware.org, ross.johnson@homemail.com.au Subject: Pthreads-win32 and static linking Message-ID: <20100510195037.GA7348@lambers.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline OpenPGP: id=15BC348B; url=http://www.marlam.de/key.txt User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact pthreads-win32-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sourceware.org X-SW-Source: 2010/txt/msg00005.txt.bz2 Hello! The Mingw-cross-env project provides a MinGW cross-compiling environment for POSIX systems. For various reasons, all included libraries are static, including the pthreads-win32 library. This means that all pthreads users need to call pthread_win32_thread_attach_np() and pthread_win32_thread_detach_np() in each thread function. We would like to avoid patching all libraries that use pthread, and instead change pthreads-win32: instead of using a thread main function given to pthread_create() directly, pthreads-win32 could use an internal wrapper that calls the thread main function and also calls the attach/detach functions if necessary. To avoid the pthread_win32_process_attach() function, pthreads-win32 could check on each function call whether the library was initialized, and if not, call pthread_win32_process_attach() itself. This would induce some overhead, but would allow us to use a large number of existing libraries unchanged. Before we start to work on a patch, we would like to know if this approach has a chance to work. Do you know any technical reasons why this might fail? Best regards, Martin