This is the mail archive of the pthreads-win32@sourceware.org mailing list for the pthreas-win32 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: Does static library works ?


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 <arnaud.richard@st.com>:

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 <arnaud.richard@st.com> 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"






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