Building Pthread static library for VS2005 pthread
In case you're trying to find a way to use pthreads-win32 as a static lib
Build pthread
- Get the pthread source code from: http://www.sourceware.org/pthreads-win32/
- Define PTW32_STATIC_LIB to build pthreads.
Be careful to use the same setting for code generation in the lib generation and your project - Debug Multithread DLL (/MDd) or Multithread DLL (/MD).
This will avoid any error with “_errno not found”
Build your application
- Define PTW32_STATIC_LIB in your project which will use pthreads (because this define will change the behaviour of pthreads.h file). This will avoid any error msg with “dll implicit…”
- When pthreads is used as a DLL, the code in dll.c is execute when the dll is loaded. So when using as a static lib, you'll need to call these code also during the initialization and destruction of your process: pthread_win32_process_attach_np(); and for release: pthread_win32_process_detach_np(); This will avoid the crash when you call pthread_create.