From: William E. Kempf (wekempf_at_[hidden])
Date: 2003-03-21 13:52:29
> Hi all,
> I'm using the boost version 1.30 release, on Win2k and the VC7.1
> I'm porting a big application from Unix to Windows. Because for all the
> modules within this app I created
> a VC++ workspace I would like to do the same for the thread library from
> For this I did the following steps:
> 1) Create with VC7.1 a "Static library" application without "Precompiled
> 2) Add to this lib the source files (from boost_1_30_0\libs\thread\src):
> 3) Set the right paths of the project for finding the includes
> 4) Build the lib
> My questions/problems are:
> 1) Are ok the above steps that I have done? Is it ok that I created it
> as a static lib (this is how I would
> like to have it)?
Not if you make use of thread_specific_ptr<> in any of your code. Note
also that the next version of Boost.Threads will be doing this internally
for boost::thread itself... so a static build won't really be possible
with that release.
> 2) Are there any preprocessor flags that I have to add to the project?
> If yes from where can I
> find out which should I set?
Just make sure you're linking to the multi-threaded C RTL.
> 3) I got a lot of warnings like: "xtime.cpp(75) : warning C4273:
> 'boost::xtime_get' : inconsistent dll linkage". Actually there are 119
> warnings like this one (C4273 and C4275).
> Why do I get these warnings? Is there a way to eliminate them? Should I
> be worried about them?
You'll have to add code to $BOOST_ROOT/boost/thread/detail/config.hpp to
not define BOOST_THREAD_DECL when building a static library.
> 4) Actually I'm using the thread lib from boost, just because it seems
> that it is used by spirit when adding the
> "SPIRIT_THREADSAFE" flag.
> Looking a little through the boost source files comments I saw that by
> default the Windows native threads are used.
> But the threads created specifically by the application are posix
> threads so for them I used the pthread-win32 lib.
> Can I have problems because there will be both types of threads?
I wouldn't expect problems, but you can compile Boost.Threads with
pthreads-win32 if you want (at least with this version... the next release
probably won't work with this configuration, and I have to admit that I've
not tested this build variant in quite a while). Look at
$BOOST_ROOT/libs/thread/build/threads.jam to see how to do this.
-- William E. Kempf
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk