Boost logo

Boost :

From: Tony Juricic (tonygeek_at_[hidden])
Date: 2004-08-01 16:36:18


"Bronek Kozicki" wrote:

> What I understand (it's quite blury picture right now) is that if you
> define one of:
> a) int _tls_index
> or
> b) _declspec(thread) some_variable
>
> any of them will result in two things:
> * section .tls will be created
> * symbol __tls_used will be created and put in .tls section

The automatic creation of _tls_used does not happen in my tests. To be more
precise, I was considering Matt Pietrek's 'Under The Hood' article from 1999
stating:

"...These functions are prototyped as IMAGE_TLS_CALLBACK functions, which
are defined in WINNT.H. Not coincidentally, the TLS initialization callbacks
happen to look just like a DllMain function. For what it's worth, when using
__declspec(thread) variables, Visual C++ emits data that causes this routine
to be invoked. However, no actual callbacks are currently defined by the
runtime library, so the array of function pointers is a single NULL entry."

However, in my case that does not seem to be a true for a static library (in
contrast to implicitly linked DLL) created with Visual Studio 2003 (VC++
71.), all in Debug mode.

I looked at:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_rules_and_limitations_for_tls.asp

but it does not mention any specific issues with static libraries.

Tony


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