$> man42.net Blog written by a human

I am currently building an application that targets Mac OS, Linux and Windows, both on 32-bit and 64-bit versions.
This application relies on pthread-win32 (needed by gsoap and sofia-sip).

The problem is that the latest released version of pthread-w32 date of December 2006 and doesn't work well with Windows 64-bit.
After some search, I discovered that the project was still active on their CVS and that it works quite well with Windows 64-bit :)

# How-to build pthread-w32 on Windows 64-bit

Checkout the latest CVS version (warning: I only tested the revision 1.90 on date of 2011/05/06 02:11:50).

$> cvs -d :pserver:anoncvs@sourceware.org:/cvs/pthreads-win32 login
{enter "anoncvs" for the password}
$> cvs -d :pserver:anoncvs@sourceware.org:/cvs/pthreads-win32 checkout pthreads

Apply this patch to use correct libraries on debug compilation:

--- .\old\pthreads\Makefile 2011-09-06 15:40:29 +0000
+++ .\new\pthreads\Makefile 2011-09-06 13:55:09 +0000
@@ -26,9 +26,9 @@

CC = cl
-XCFLAGS = /W3 /MD /nologo
+XCFLAGS = /W3 /nologo

# Uncomment this if config.h defines RETAIN_WSALASTERROR
#XLIBS = wsock32.lib

Open a command prompt (cmd.exe), go to the folder that contains the pthread-w32 source.
Type the following (replace the Visual Studio path by yours!):

$> "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" amd64
$> nmake clean VC
$> nmake clean VC-debug

Now you can use pthreadVC2.dll, pthreadVC2.lib, pthreadVC2d.dll and pthreadVC2d.lib with your project!
Optional: you can test it but going on the "tests" subdirectory and type nmake VC.

This version seems to work very well with my project. But keep in mind that this version was not released by its authors, so it's still a testing and possibly unstable version!

Buffer this pageShare on TumblrDigg thisShare on FacebookShare on LinkedInTweet about this on TwitterEmail this to someoneShare on Google+Share on RedditPin on Pinterest