From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24719 invoked by alias); 24 Apr 2008 12:53:27 -0000 Received: (qmail 24709 invoked by uid 22791); 24 Apr 2008 12:53:26 -0000 X-Spam-Check-By: sourceware.org Received: from sv2.lisha.ufsc.br (HELO smtp.lisha.ufsc.br) (150.162.62.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 24 Apr 2008 12:53:07 +0000 Received: by smtp.lisha.ufsc.br (Postfix, from userid 99) id A0C72BF03B; Thu, 24 Apr 2008 09:53:04 -0300 (BRT) Received: from [192.168.2.3] (92-235-189-193.cable.ubr18.edin.blueyonder.co.uk [92.235.189.193]) (Authenticated sender: ramiro) by smtp.lisha.ufsc.br (Postfix) with ESMTP id CF890BF034 for ; Thu, 24 Apr 2008 09:53:03 -0300 (BRT) Message-ID: <481082AE.3030904@lisha.ufsc.br> Date: Thu, 24 Apr 2008 12:53:00 -0000 From: Ramiro Polla User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: pthreads-win32@sourceware.org Subject: Static libraries initialization Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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: 2008/txt/msg00019.txt.bz2 Hello, pthreads-win32 requires programs that use the library statically to call some (de)initialization code, which would be the same code called by DllMain(). There are plenty of messages regarding this on the mailinglist. This makes the library not very developer friendly. It causes code duplication for every program that wants to use the library statically, #ifdef mess and harder configuration checks. 1- Why isn't this initialization done by pthreads-win32 itself? All pthread_* functions could have an if(!initialized) {...} block before running any code that depends on it. 2- Static pthreads-win32 libraries should at least check if they were properly initialized before allowing pthread_* functions to run. Returning an error is far better than having the program crash. Ramiro Polla