From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15343 invoked by alias); 7 Feb 2009 00:24:09 -0000 Received: (qmail 15332 invoked by uid 22791); 7 Feb 2009 00:24:08 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from flexo.grapevine.net.au (HELO flexo.grapevine.net.au) (203.129.32.140) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 07 Feb 2009 00:23:57 +0000 Received: from localhost (localhost [127.0.0.1]) by flexo.grapevine.net.au (Postfix) with ESMTP id A19E558317F for ; Sat, 7 Feb 2009 11:23:53 +1100 (EST) Received: from flexo.grapevine.net.au ([127.0.0.1]) by localhost (flexo.grapevine.net.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IXKMlmvdk5m9 for ; Sat, 7 Feb 2009 11:23:53 +1100 (EST) Received: from localhost.localdomain (ppp-20.204.127.121.grapevine.net.au [121.127.204.20]) by flexo.grapevine.net.au (Postfix) with ESMTP id 42B43583173 for ; Sat, 7 Feb 2009 11:23:53 +1100 (EST) Message-ID: <498CD498.1050303@homemail.com.au> Date: Sat, 07 Feb 2009 00:24:00 -0000 From: Ross Johnson User-Agent: Thunderbird 2.0.0.14 (X11/20080501) MIME-Version: 1.0 To: pthreads-win32@sourceware.org Subject: Re: Does static library works ? References: <498C08A3.4030509@st.com> <2148c4de0902060211l38c61302p24fdd29d9d5d35bf@mail.gmail.com> <498C3246.6070700@st.com> <20090206080622.86fffqqxcc4ws0k8@webmail.pioneerwireless.ca> In-Reply-To: <20090206080622.86fffqqxcc4ws0k8@webmail.pioneerwireless.ca> Content-Type: text/plain; charset=UTF-8; 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: 2009/txt/msg00006.txt.bz2 In the distributed sources there is just one test case (self1.c) that runs for the static case, and it checks that the library is able to perform an implicit creation of a POSIX thread handle, i.e. as the library will do whenever a POSIX thread routine that requires a POSIX handle is called from a Windows native thread. Pthread_self() is the only routine in the library where this is done and all other pthreads routines call it if required. There is one other check that should be done for static linking (but isn't), which is to check that the destructors, for TSD etc, actually run as required. Otherwise, as observed, all other functionality of the library is tested using the DLL version. I felt that repeating all the tests for the static case is a redundant exercise when the additional static functions rarely if ever change. If Richard has successfully run all the tests with his modified makefile without modifying the tests sources then the implicit resource create and destroy logic in the static library hasn't really been tested because only one or two tests actually result in implicit resource creation. Ross John E. Bossom wrote: > The mechanisms of the pthreads library where originally written to > take advantage of the Windows DllMain for implicitly > creating/releasing resources. > However, some didn't want to use the DLL... therefore the implicit > creation/destruction of resources (as well as the implicit invocation > of TSD optional destructors) must be carried out explicitly by the > user in the event that they want to use a static library. These > methods are _np (non portable). > > I would have expected that the test cases would have been > conditionally compiled to accommodate the testing of the static > version of the library... > > John E. Bossom > > Quoting Arnaud RICHARD : > >> I have tried with MinGW. >> It doesn't pass either. (but pass in dynamic of course). >> So it is not due to something specific to MSVC. >> >> Looking more closely... I found out than some functions must be called >> only when linking statically: >> pthread_win32_process_attach_np() >> pthread_win32_process_detach_np() >> pthread_win32_thread_attach_np() >> pthread_win32_thread_detach_np() >> >> There is some explanations in the file README.NONPORTABLE >> >> It's the first time ever I see code specific to static linking... >> maybe because I'm a newbie on MS platform. >> I post this solution for future >> >> Arnaud >> >>> Arnaud RICHARD wrote: >>> >>>> Dear developers, >>>> >>>> I tried to build my program statically with pthreads.lib. >>>> It crash at run-time in "pthread_cond_init()". >>>> So I tried to run the tests. >>>> First surprise: the test suite only run with DLL, and not with .LIB. >>>> I have enhanced the makefile to run the tests in static. >>>> Second surprise: most tests fails (but not all). >>>> >>>> Has anyone tried to do it ? >>>> I attached the modified makefile, the target to run is "make clean >>>> VC-static" >>>> >>>> Any feedback welcome, >>>> Arnaud >>>> >>>> PS: I use MSVC2008, and compile "VC-static" >>>> >>>> >>>> > >