Boost logo

Boost :

From: Bronek Kozicki (brok_at_[hidden])
Date: 2004-08-01 15:31:22


Tony Juricic wrote:

>>I think that definition of _tls_used (from Holger) is
>>something new and useful :>
>
>
> That's great!
>
> _tls_used variable appears to be absolutely required. To explain, I was

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

b) is actually documented in MSDN. Trouble is that if you do one of a)
or b), symbol __tls_used will be defined by compiler and I do not know
how to put there (using MSVC6) address of your callback function. It
seems that MSVC6 just does not support appending anything to .tls
section. However, you may define this symbol ("extern "C" const DWORD
_tls_used[6]; const DWORD _tls_used[6] = ...") yourself in executable
(but not in .tls section) and if you build this symbol right way (as
demonstrated by Holger and specified in section 6.7.1 of PE/COFF
specification) your callback procedure will be recognized by operating
system and called at the right time. I think that it does not conform to
PE/COFF specification (section 6.7 explicitly specify section name .tls)
but it works, even on MSVC6 (but not under MinGW, hmmm ...).

B.


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