Boost logo

Boost :

Subject: Re: [boost] [threads] namespace & externs
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2011-01-26 03:35:45


scot shinderman <scot_at_[hidden]> writes:

> In boost/thread/src/pthread/thread.cpp we see extern "C" {}
> around code such as tls_destructor. Is this needed so it
> interfaces w/ native pthread local storage?

Yes.

> When a vendor program is built against a specific version
> of boost it usually becomes necessary to isolate other users
> via a namespace. However, anything with extern "C"
> style defeats this. Aside from explicit linking to native c
> api's are there reasons for this; also what's considered the best
> style to isolate different versions -- currently we modify every header
> with a version-ed namespace wrapper.

extern "C" is only used where it is necessary (at least, that is the
intent). If you need the extern "C" stuff to be versioned then you'll
have to rename it. Renaming the namespace seems a sensible option for
the rest of the code.

Anthony

-- 
Author of C++ Concurrency in Action     http://www.stdthread.co.uk/book/
just::thread C++0x thread library             http://www.stdthread.co.uk
Just Software Solutions Ltd       http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk